Search in sources :

Example 6 with PasswordFileConfig

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

the class FileAuthenticationProviderTest method shouldNotEngageWhenPasswordFileIsNotConfigured.

@Test
public void shouldNotEngageWhenPasswordFileIsNotConfigured() throws Exception {
    FileAuthenticationProvider provider = new FileAuthenticationProvider(goConfigService, null, userService, securityService);
    when(goConfigService.security()).thenReturn(new SecurityConfig(null, new PasswordFileConfig(), true));
    assertThat(provider.supports(UsernamePasswordAuthenticationToken.class), is(false));
}
Also used : SecurityConfig(com.thoughtworks.go.config.SecurityConfig) UsernamePasswordAuthenticationToken(org.springframework.security.providers.UsernamePasswordAuthenticationToken) PasswordFileConfig(com.thoughtworks.go.config.PasswordFileConfig) Test(org.junit.Test)

Example 7 with PasswordFileConfig

use of com.thoughtworks.go.config.PasswordFileConfig 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

PasswordFileConfig (com.thoughtworks.go.config.PasswordFileConfig)7 LdapConfig (com.thoughtworks.go.config.LdapConfig)6 Test (org.junit.Test)6 SecurityConfig (com.thoughtworks.go.config.SecurityConfig)4 AdminsConfig (com.thoughtworks.go.config.AdminsConfig)3 BaseConfig (com.thoughtworks.go.config.server.security.ldap.BaseConfig)3 BasesConfig (com.thoughtworks.go.config.server.security.ldap.BasesConfig)3 GoCipher (com.thoughtworks.go.security.GoCipher)2 AuthorityGranter (com.thoughtworks.go.server.security.AuthorityGranter)1 File (java.io.File)1 UsernamePasswordAuthenticationToken (org.springframework.security.providers.UsernamePasswordAuthenticationToken)1