use of com.thoughtworks.go.config.SecurityAuthConfig in project gocd by gocd.
the class SecurityAuthConfigServiceTest method shouldPerformPluginValidationsBeforeUpdatingSecurityAuthConfig.
@Test
public void shouldPerformPluginValidationsBeforeUpdatingSecurityAuthConfig() {
SecurityAuthConfig securityAuthConfig = new SecurityAuthConfig("ldap", "cd.go.ldap", create("key", false, "value"));
Username username = new Username("username");
securityAuthConfigService.update(username, "md5", securityAuthConfig, new HttpLocalizedOperationResult());
verify(extension).validateAuthConfig(securityAuthConfig.getPluginId(), securityAuthConfig.getConfigurationAsMap(true));
}
use of com.thoughtworks.go.config.SecurityAuthConfig in project gocd by gocd.
the class SecurityAuthConfigServiceTest method verifyConnection_shouldSendSuccessResponseOnSuccessfulVerification.
@Test
public void verifyConnection_shouldSendSuccessResponseOnSuccessfulVerification() throws Exception {
VerifyConnectionResponse success = new VerifyConnectionResponse("success", "Connection check passed", new ValidationResult());
SecurityAuthConfig ldap = new SecurityAuthConfig("ldap", "cd.go.ldap");
when(extension.verifyConnection("cd.go.ldap", ldap.getConfigurationAsMap(true))).thenReturn(success);
VerifyConnectionResponse response = securityAuthConfigService.verifyConnection(ldap);
assertThat(response, is(success));
}
use of com.thoughtworks.go.config.SecurityAuthConfig in project gocd by gocd.
the class SecurityAuthConfigServiceTest method shouldNotPerformPluginValidationsWhenDeletingSecurityAuthConfig.
@Test
public void shouldNotPerformPluginValidationsWhenDeletingSecurityAuthConfig() {
SecurityAuthConfig securityAuthConfig = new SecurityAuthConfig("ldap", "cd.go.ldap", create("key", false, "value"));
Username username = new Username("username");
securityAuthConfigService.delete(username, securityAuthConfig, new HttpLocalizedOperationResult());
verify(extension, never()).validateAuthConfig(securityAuthConfig.getPluginId(), securityAuthConfig.getConfigurationAsMap(true));
}
use of com.thoughtworks.go.config.SecurityAuthConfig in project gocd by gocd.
the class SecurityAuthConfigServiceTest method shouldUpdateExistingSecurityAuthConfigInConfig.
@Test
public void shouldUpdateExistingSecurityAuthConfigInConfig() {
SecurityAuthConfig securityAuthConfig = new SecurityAuthConfig("ldap", "cd.go.ldap");
Username username = new Username("username");
securityAuthConfigService.update(username, "md5", securityAuthConfig, new HttpLocalizedOperationResult());
verify(goConfigService).updateConfig(any(SecurityAuthConfigUpdateCommand.class), eq(username));
}
use of com.thoughtworks.go.config.SecurityAuthConfig in project gocd by gocd.
the class SecurityAuthConfigServiceTest method shouldDeleteExistingSecurityAuthConfigInConfig.
@Test
public void shouldDeleteExistingSecurityAuthConfigInConfig() {
SecurityAuthConfig securityAuthConfig = new SecurityAuthConfig("ldap", "cd.go.ldap");
Username username = new Username("username");
securityAuthConfigService.delete(username, securityAuthConfig, new HttpLocalizedOperationResult());
verify(goConfigService).updateConfig(any(SecurityAuthConfigDeleteCommand.class), eq(username));
}
Aggregations