Search in sources :

Example 1 with AdminsConfig

use of com.thoughtworks.go.config.AdminsConfig in project gocd by gocd.

the class LdapConfigChangedListenerTest method shouldReinitializeDelegator_whenLdapManagerPasswordChanges.

@Test
public void shouldReinitializeDelegator_whenLdapManagerPasswordChanges() {
    LdapConfig oldLdapConfig = new LdapConfig("oldOne", "manager", "pwd", null, true, new BasesConfig(new BaseConfig("foo")), "bar");
    helper.addLdapSecurityWith(oldLdapConfig, true, new PasswordFileConfig(), new AdminsConfig());
    LdapContextFactory mockContextFactory = mock(LdapContextFactory.class);
    LdapConfigChangedListener listener = new LdapConfigChangedListener(oldLdapConfig, mockContextFactory);
    LdapConfig newLdapConfig = new LdapConfig("oldOne", "manager", "new_pwd", null, true, new BasesConfig(new BaseConfig("foo")), "bar");
    helper.addLdapSecurityWith(newLdapConfig, true, new PasswordFileConfig(), new AdminsConfig());
    listener.onConfigChange(helper.currentConfig());
    verify(mockContextFactory).initializeDelegator();
}
Also used : LdapConfig(com.thoughtworks.go.config.LdapConfig) BasesConfig(com.thoughtworks.go.config.server.security.ldap.BasesConfig) BaseConfig(com.thoughtworks.go.config.server.security.ldap.BaseConfig) PasswordFileConfig(com.thoughtworks.go.config.PasswordFileConfig) AdminsConfig(com.thoughtworks.go.config.AdminsConfig) Test(org.junit.Test)

Example 2 with AdminsConfig

use of com.thoughtworks.go.config.AdminsConfig in project gocd by gocd.

the class LdapConfigChangedListenerTest method shouldNotTriggerReintializeOfContextFactoryWhenLdapConfigDoesNotChange.

@Test
public void shouldNotTriggerReintializeOfContextFactoryWhenLdapConfigDoesNotChange() {
    LdapConfig oldLdapConfig = new LdapConfig("oldOne", "manager", "pwd", null, true, new BasesConfig(new BaseConfig("foo")), "bar");
    helper.addLdapSecurityWith(oldLdapConfig, true, new PasswordFileConfig(), new AdminsConfig());
    LdapContextFactory mockContextFactory = mock(LdapContextFactory.class);
    LdapConfigChangedListener listener = new LdapConfigChangedListener(oldLdapConfig, mockContextFactory);
    helper.addLdapSecurityWith(oldLdapConfig, true, new PasswordFileConfig(), new AdminsConfig());
    listener.onConfigChange(helper.currentConfig());
    verify(mockContextFactory, never()).initializeDelegator();
}
Also used : LdapConfig(com.thoughtworks.go.config.LdapConfig) BasesConfig(com.thoughtworks.go.config.server.security.ldap.BasesConfig) BaseConfig(com.thoughtworks.go.config.server.security.ldap.BaseConfig) PasswordFileConfig(com.thoughtworks.go.config.PasswordFileConfig) AdminsConfig(com.thoughtworks.go.config.AdminsConfig) Test(org.junit.Test)

Example 3 with AdminsConfig

use of com.thoughtworks.go.config.AdminsConfig in project gocd by gocd.

the class LdapConfigChangedListenerTest method shouldTriggerReintializeOfContextFactoryOnChangeOnLdapConfig.

@Test
public void shouldTriggerReintializeOfContextFactoryOnChangeOnLdapConfig() {
    LdapConfig oldLdapConfig = new LdapConfig("oldOne", "manager", "pwd", null, true, new BasesConfig(new BaseConfig("foo")), "bar");
    LdapConfig newLdapConfig = new LdapConfig("newOne", "manager", "pwd", null, true, new BasesConfig(new BaseConfig("foo")), "bar");
    helper.addLdapSecurityWith(oldLdapConfig, true, new PasswordFileConfig(), new AdminsConfig());
    LdapContextFactory mockContextFactory = mock(LdapContextFactory.class);
    LdapConfigChangedListener listener = new LdapConfigChangedListener(oldLdapConfig, mockContextFactory);
    helper.addLdapSecurityWith(newLdapConfig, true, new PasswordFileConfig(), new AdminsConfig());
    listener.onConfigChange(helper.currentConfig());
    verify(mockContextFactory, times(1)).initializeDelegator();
}
Also used : LdapConfig(com.thoughtworks.go.config.LdapConfig) BasesConfig(com.thoughtworks.go.config.server.security.ldap.BasesConfig) BaseConfig(com.thoughtworks.go.config.server.security.ldap.BaseConfig) PasswordFileConfig(com.thoughtworks.go.config.PasswordFileConfig) AdminsConfig(com.thoughtworks.go.config.AdminsConfig) Test(org.junit.Test)

Aggregations

AdminsConfig (com.thoughtworks.go.config.AdminsConfig)3 LdapConfig (com.thoughtworks.go.config.LdapConfig)3 PasswordFileConfig (com.thoughtworks.go.config.PasswordFileConfig)3 BaseConfig (com.thoughtworks.go.config.server.security.ldap.BaseConfig)3 BasesConfig (com.thoughtworks.go.config.server.security.ldap.BasesConfig)3 Test (org.junit.Test)3