use of oidc.repository.AuthenticationRequestRepository in project OpenConext-oidcng by OpenConext.
the class ConcurrentSavedRequestAwareAuthenticationSuccessHandlerTest method onAuthenticationSuccess.
@Test
public void onAuthenticationSuccess() throws IOException {
AuthenticationRequestRepository authenticationRequestRepository = mock(AuthenticationRequestRepository.class);
ConcurrentSavedRequestAwareAuthenticationSuccessHandler subject = new ConcurrentSavedRequestAwareAuthenticationSuccessHandler(authenticationRequestRepository);
when(authenticationRequestRepository.findById(isNull())).thenReturn(Optional.of(new AuthenticationRequest("ID", new Date(), "client_id", "http://localhost")));
MockHttpServletResponse response = new MockHttpServletResponse();
subject.onAuthenticationSuccess(new MockHttpServletRequest(), response, new OidcSamlAuthentication());
assertEquals("http://localhost", response.getHeader("Location"));
assertEquals(HttpServletResponse.SC_MOVED_TEMPORARILY, response.getStatus());
}
Aggregations