Search in sources :

Example 1 with AuthenticationServiceException

use of org.springframework.security.AuthenticationServiceException in project gocd by gocd.

the class AuthenticationProcessingFilterTest method shouldSetSecurityExceptionMessageOnSessionWhenAuthenticationServiceExceptionIsThrownBySpring.

@Test
public void shouldSetSecurityExceptionMessageOnSessionWhenAuthenticationServiceExceptionIsThrownBySpring() throws Exception {
    when(localizer.localize("AUTHENTICATION_SERVICE_EXCEPTION")).thenReturn("some server error");
    filter.onUnsuccessfulAuthentication(request, null, new AuthenticationServiceException("foobar"));
    assertThat(((Exception) session.getAttribute(AuthenticationProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY)).getMessage(), is("some server error"));
}
Also used : AuthenticationServiceException(org.springframework.security.AuthenticationServiceException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 AuthenticationServiceException (org.springframework.security.AuthenticationServiceException)1