Search in sources :

Example 1 with AuthnFailedErrorState

use of uk.gov.ida.hub.policy.domain.state.AuthnFailedErrorState in project verify-hub by alphagov.

the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInAuthnFailedErrorState.

@Test
public void shouldReturnErrorResponseWhenAskedAndInAuthnFailedErrorState() {
    AuthnFailedErrorState state = AuthnFailedErrorStateBuilder.anAuthnFailedErrorState().build();
    StateController stateController = new AuthnFailedErrorStateController(state, responseFromHubFactory, stateTransitionAction, transactionsConfigProxy, identityProvidersConfigProxy, hubEventLogger);
    when(sessionRepository.getStateController(sessionId, ErrorResponsePreparedState.class)).thenReturn(stateController);
    ResponseFromHub responseFromHub = authnRequestFromTransactionHandler.getErrorResponseFromHub(sessionId);
    assertThat(responseFromHub.getStatus()).isEqualTo(TransactionIdaStatus.NoAuthenticationContext);
}
Also used : StateController(uk.gov.ida.hub.policy.domain.StateController) AuthnFailedErrorState(uk.gov.ida.hub.policy.domain.state.AuthnFailedErrorState) ResponseFromHub(uk.gov.ida.hub.policy.domain.ResponseFromHub) Test(org.junit.Test)

Example 2 with AuthnFailedErrorState

use of uk.gov.ida.hub.policy.domain.state.AuthnFailedErrorState in project verify-hub by alphagov.

the class TestSessionResourceHelper method createSessionInAuthnFailedErrorState.

public static Response createSessionInAuthnFailedErrorState(SessionId sessionId, Client client, URI uri) {
    AuthnFailedErrorState state = AuthnFailedErrorStateBuilder.anAuthnFailedErrorState().build();
    TestSessionDto testSessionDto = new TestSessionDto(sessionId, state.getRequestId(), state.getSessionExpiryTimestamp(), state.getIdpEntityId(), state.getRelayState().orNull(), null, null, null, state.getAssertionConsumerServiceUri(), Collections.emptyList(), false, state.getTransactionSupportsEidas());
    return client.target(uri).request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(testSessionDto));
}
Also used : AuthnFailedErrorState(uk.gov.ida.hub.policy.domain.state.AuthnFailedErrorState)

Aggregations

AuthnFailedErrorState (uk.gov.ida.hub.policy.domain.state.AuthnFailedErrorState)2 Test (org.junit.Test)1 ResponseFromHub (uk.gov.ida.hub.policy.domain.ResponseFromHub)1 StateController (uk.gov.ida.hub.policy.domain.StateController)1