List of usage examples for org.springframework.security.web.authentication AbstractAuthenticationProcessingFilter setAuthenticationSuccessHandler
public void setAuthenticationSuccessHandler(AuthenticationSuccessHandler successHandler)
From source file:org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilterTests.java
@Test public void testStartupDetectsInvalidAuthenticationManager() throws Exception { AbstractAuthenticationProcessingFilter filter = new MockAuthenticationFilter(); filter.setAuthenticationFailureHandler(failureHandler); successHandler.setDefaultTargetUrl("/"); filter.setAuthenticationSuccessHandler(successHandler); filter.setFilterProcessesUrl("/login"); try {/*from ww w . jav a 2 s. c om*/ filter.afterPropertiesSet(); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage()).isEqualTo("authenticationManager must be specified"); } }
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 {/*from w w w .j av a 2 s . c o m*/ filter.setFilterProcessesUrl(null); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage()).isEqualTo("Pattern cannot be null or empty"); } }