Search in sources :

Example 1 with AbstractContextSource

use of org.springframework.ldap.core.support.AbstractContextSource in project gocd by gocd.

the class LdapContextSourceConfiguratorTest method shouldSet_ManagerDnAndPassword_OnContextSource.

@Test
public void shouldSet_ManagerDnAndPassword_OnContextSource() {
    LdapContextSourceConfigurator configurator = new LdapContextSourceConfigurator(new LdapConfig("uri", "managerDn", "managerPass", null, true, new BasesConfig(new BaseConfig("searchBase")), "searchFilter"));
    AbstractContextSource ctxSrc = mock(AbstractContextSource.class);
    configurator.configure(ctxSrc);
    verify(ctxSrc).setPassword("managerPass");
    verify(ctxSrc).setUserDn("managerDn");
}
Also used : LdapConfig(com.thoughtworks.go.config.LdapConfig) BasesConfig(com.thoughtworks.go.config.server.security.ldap.BasesConfig) AbstractContextSource(org.springframework.ldap.core.support.AbstractContextSource) BaseConfig(com.thoughtworks.go.config.server.security.ldap.BaseConfig) Test(org.junit.Test)

Example 2 with AbstractContextSource

use of org.springframework.ldap.core.support.AbstractContextSource in project gocd by gocd.

the class LdapContextSourceConfiguratorTest method shouldNotSet_EitherManagerDn_OrPassword_OnContextSource_WhenNoManagerDnConfigured.

@Test
public void shouldNotSet_EitherManagerDn_OrPassword_OnContextSource_WhenNoManagerDnConfigured() {
    GoCipher goCipher = new GoCipher();
    LdapContextSourceConfigurator configurator = new LdapContextSourceConfigurator(new LdapConfig(goCipher));
    AbstractContextSource ctxSrc = mock(AbstractContextSource.class);
    configurator.configure(ctxSrc);
    verify(ctxSrc, never()).setPassword(any(String.class));
    verify(ctxSrc, never()).setUserDn(any(String.class));
}
Also used : LdapConfig(com.thoughtworks.go.config.LdapConfig) GoCipher(com.thoughtworks.go.security.GoCipher) AbstractContextSource(org.springframework.ldap.core.support.AbstractContextSource) Test(org.junit.Test)

Aggregations

LdapConfig (com.thoughtworks.go.config.LdapConfig)2 Test (org.junit.Test)2 AbstractContextSource (org.springframework.ldap.core.support.AbstractContextSource)2 BaseConfig (com.thoughtworks.go.config.server.security.ldap.BaseConfig)1 BasesConfig (com.thoughtworks.go.config.server.security.ldap.BasesConfig)1 GoCipher (com.thoughtworks.go.security.GoCipher)1