Search in sources :

Example 1 with DefaultJaasAuthenticationProvider

use of org.springframework.security.authentication.jaas.DefaultJaasAuthenticationProvider in project spring-security by spring-projects.

the class DefaultJaasAuthenticationProviderTests method setUp.

@Before
public void setUp() throws Exception {
    Configuration configuration = mock(Configuration.class);
    publisher = mock(ApplicationEventPublisher.class);
    log = mock(Log.class);
    provider = new DefaultJaasAuthenticationProvider();
    provider.setConfiguration(configuration);
    provider.setApplicationEventPublisher(publisher);
    provider.setAuthorityGranters(new AuthorityGranter[] { new TestAuthorityGranter() });
    provider.afterPropertiesSet();
    AppConfigurationEntry[] aces = new AppConfigurationEntry[] { new AppConfigurationEntry(TestLoginModule.class.getName(), LoginModuleControlFlag.REQUIRED, Collections.<String, Object>emptyMap()) };
    when(configuration.getAppConfigurationEntry(provider.getLoginContextName())).thenReturn(aces);
    token = new UsernamePasswordAuthenticationToken("user", "password");
    ReflectionTestUtils.setField(provider, "log", log);
}
Also used : DefaultJaasAuthenticationProvider(org.springframework.security.authentication.jaas.DefaultJaasAuthenticationProvider) AppConfigurationEntry(javax.security.auth.login.AppConfigurationEntry) Configuration(javax.security.auth.login.Configuration) Log(org.apache.commons.logging.Log) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken) Before(org.junit.Before)

Aggregations

AppConfigurationEntry (javax.security.auth.login.AppConfigurationEntry)1 Configuration (javax.security.auth.login.Configuration)1 Log (org.apache.commons.logging.Log)1 Before (org.junit.Before)1 ApplicationEventPublisher (org.springframework.context.ApplicationEventPublisher)1 UsernamePasswordAuthenticationToken (org.springframework.security.authentication.UsernamePasswordAuthenticationToken)1 DefaultJaasAuthenticationProvider (org.springframework.security.authentication.jaas.DefaultJaasAuthenticationProvider)1