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"));
}
Aggregations