List of usage examples for org.springframework.security.web.authentication AbstractAuthenticationProcessingFilter setAuthenticationFailureHandler
public void setAuthenticationFailureHandler(AuthenticationFailureHandler failureHandler)
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 w w w .ja va 2 s . c o m 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.jav a2 s. co m*/ filter.setFilterProcessesUrl(null); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage()).isEqualTo("Pattern cannot be null or empty"); } }