use of com.thoughtworks.go.config.SecurityAuthConfig in project gocd by gocd.
the class SecurityAuthConfigRepresenter method fromJSON.
public static SecurityAuthConfig fromJSON(JsonReader jsonReader) {
SecurityAuthConfig securityAuthConfig = new SecurityAuthConfig(jsonReader.optString("id").orElse(null), jsonReader.getString("plugin_id"));
securityAuthConfig.setAllowOnlyKnownUsersToLogin(jsonReader.optBoolean("allow_only_known_users_to_login").orElse(false));
securityAuthConfig.addConfigurations(ConfigurationPropertyRepresenter.fromJSONArray(jsonReader, "properties"));
return securityAuthConfig;
}
use of com.thoughtworks.go.config.SecurityAuthConfig in project gocd by gocd.
the class SecurityAuthConfigInternalControllerV2 method verifyConnection.
public String verifyConnection(Request request, Response response) throws IOException {
SecurityAuthConfig securityAuthConfig = buildEntityFromRequestBody(request);
VerifyConnectionResponse verifyConnectionResponse = securityAuthConfigService.verifyConnection(securityAuthConfig);
if (!verifyConnectionResponse.isSuccessful()) {
response.status(422);
}
return writerForTopLevelObject(request, response, writer -> VerifyConnectionResponseRepresenter.toJSON(writer, verifyConnectionResponse, securityAuthConfig));
}
use of com.thoughtworks.go.config.SecurityAuthConfig in project gocd by gocd.
the class SecurityAuthConfigUpdateCommand method update.
@Override
public void update(CruiseConfig preprocessedConfig) {
SecurityAuthConfig existingProfile = findExistingProfile(preprocessedConfig);
SecurityAuthConfigs profiles = getPluginProfiles(preprocessedConfig);
profiles.set(profiles.indexOf(existingProfile), profile);
}
use of com.thoughtworks.go.config.SecurityAuthConfig in project gocd by gocd.
the class AuthorizationMessageConverterV1 method getAuthConfigs.
private List<Map<String, Object>> getAuthConfigs(List<SecurityAuthConfig> authConfigs) {
List<Map<String, Object>> configs = new ArrayList<>();
if (authConfigs == null) {
return configs;
}
for (SecurityAuthConfig securityAuthConfig : authConfigs) {
Map<String, Object> authConfig = new HashMap<>();
authConfig.put("id", securityAuthConfig.getId());
authConfig.put("configuration", securityAuthConfig.getConfigurationAsMap(true));
configs.add(authConfig);
}
return configs;
}
use of com.thoughtworks.go.config.SecurityAuthConfig in project gocd by gocd.
the class AuthorizationExtensionTest method shouldReturnTrueForSupportsValidatingUserExistenceForAuthorizationExtensionV2.
@Test
void shouldReturnTrueForSupportsValidatingUserExistenceForAuthorizationExtensionV2() throws Exception {
String pluginId = "cd.go.ldap";
when(pluginManager.resolveExtensionVersion(pluginId, AUTHORIZATION_EXTENSION, SUPPORTED_VERSIONS)).thenReturn(AuthorizationMessageConverterV2.VERSION);
SecurityAuthConfig authConfig = new SecurityAuthConfig("ldap", pluginId, create("url", false, "some-url"));
boolean expected = authorizationExtension.supportsPluginAPICallsRequiredForAccessToken(authConfig);
assertThat(expected).isTrue();
}
Aggregations