use of com.thoughtworks.go.config.server.security.ldap.BasesConfig in project gocd by gocd.
the class SecurityConfigTest method shouldBeAbleToTellIfSecurityMethodChangedFromNothingToLdap.
@Test
public void shouldBeAbleToTellIfSecurityMethodChangedFromNothingToLdap() {
SecurityConfig ldapSecurity = new SecurityConfig();
ldapSecurity.modifyLdap(new LdapConfig("ldap://uri", "dn", "p", null, true, new BasesConfig(new BaseConfig("")), ""));
assertTrue(new SecurityConfig().hasSecurityMethodChanged(ldapSecurity));
}
use of com.thoughtworks.go.config.server.security.ldap.BasesConfig in project gocd by gocd.
the class LdapConfigTest method shouldConvertNullAttributesToEmptyStringUponConstruct.
@Test
public void shouldConvertNullAttributesToEmptyStringUponConstruct() {
LdapConfig ldapConfig = new LdapConfig(null, null, null, null, false, new BasesConfig(), null);
assertThat(ldapConfig.uri(), is(""));
assertThat(ldapConfig.searchFilter(), is(""));
assertThat(ldapConfig.currentManagerPassword(), is(""));
assertThat(ldapConfig.isEnabled(), is(false));
}
use of com.thoughtworks.go.config.server.security.ldap.BasesConfig in project gocd by gocd.
the class LdapConfigTest method shouldConsiderTwoLdapConfigsWithDifferentPasswordsUnequal.
@Test
public void shouldConsiderTwoLdapConfigsWithDifferentPasswordsUnequal() {
LdapConfig ldapConfig1 = new LdapConfig("uri", "managerDn", "password-1", null, true, new BasesConfig(new BaseConfig("blah")), "blah");
LdapConfig ldapConfig2 = new LdapConfig("uri", "managerDn", "password-2", null, true, new BasesConfig(new BaseConfig("blah")), "blah");
assertThat(ldapConfig1, is(Matchers.not(ldapConfig2)));
assertThat(ldapConfig1.hashCode(), is(Matchers.not(ldapConfig2.hashCode())));
}
use of com.thoughtworks.go.config.server.security.ldap.BasesConfig in project gocd by gocd.
the class GoConfigServiceTest method shouldUnderstandIfLdapIsConfigured.
@Test
public void shouldUnderstandIfLdapIsConfigured() throws Exception {
CruiseConfig config = new BasicCruiseConfig();
config.setServerConfig(new ServerConfig(null, new SecurityConfig(new LdapConfig("test", "test", "test", null, true, new BasesConfig(new BaseConfig("test")), "test"), null, true, null)));
expectLoad(config);
assertThat("Ldap is configured", goConfigService.isLdapConfigured(), is(true));
}
use of com.thoughtworks.go.config.server.security.ldap.BasesConfig in project gocd by gocd.
the class GoConfigFileHelper method addLdapSecurity.
public void addLdapSecurity(String uri, String managerDn, String managerPassword, String searchBase, String searchFilter) {
LdapConfig ldapConfig = new LdapConfig(uri, managerDn, managerPassword, null, true, new BasesConfig(new BaseConfig(searchBase)), searchFilter);
addLdapSecurityWith(ldapConfig, true, new PasswordFileConfig(), new AdminsConfig());
}
Aggregations