List of usage examples for org.springframework.security.web.authentication AbstractAuthenticationProcessingFilter setAuthenticationManager
public void setAuthenticationManager(AuthenticationManager authenticationManager)
From source file:org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilterTests.java
@Test public void testGettersSetters() throws Exception { AbstractAuthenticationProcessingFilter filter = new MockAuthenticationFilter(); filter.setAuthenticationManager(mock(AuthenticationManager.class)); filter.setFilterProcessesUrl("/p"); filter.afterPropertiesSet();//from w w w . j av a 2 s . c om assertThat(filter.getRememberMeServices()).isNotNull(); filter.setRememberMeServices(new TokenBasedRememberMeServices("key", new AbstractRememberMeServicesTests.MockUserDetailsService())); assertThat(filter.getRememberMeServices().getClass()).isEqualTo(TokenBasedRememberMeServices.class); assertThat(filter.getAuthenticationManager() != null).isTrue(); }
From source file:org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilterTests.java
@Test public void testStartupDetectsInvalidFilterProcessesUrl() throws Exception { AbstractAuthenticationProcessingFilter filter = new MockAuthenticationFilter(); filter.setAuthenticationFailureHandler(failureHandler); filter.setAuthenticationManager(mock(AuthenticationManager.class)); filter.setAuthenticationSuccessHandler(successHandler); try {/*ww w . java 2 s.c om*/ filter.setFilterProcessesUrl(null); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage()).isEqualTo("Pattern cannot be null or empty"); } }