Search in sources :

Example 1 with SuccessfulMatchState

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

the class Cycle0And1MatchRequestSentStateControllerTest method responseProcessingDetails_shouldReturnCompleteStatus_successResponseSentFromMatchingService.

@Test
public void responseProcessingDetails_shouldReturnCompleteStatus_successResponseSentFromMatchingService() {
    ArgumentCaptor<SuccessfulMatchState> argumentCaptor = ArgumentCaptor.forClass(SuccessfulMatchState.class);
    MatchFromMatchingService matchFromMatchingService = new MatchFromMatchingService(MATCHING_SERVICE_ENTITY_ID, REQUEST_ID, "assertionBlob", Optional.of(LevelOfAssurance.LEVEL_1));
    controller.handleMatchResponseFromMatchingService(matchFromMatchingService);
    IdentityProvidersConfigProxy identityProvidersConfigProxy = mock(IdentityProvidersConfigProxy.class);
    verify(stateTransitionAction, times(1)).transitionTo(argumentCaptor.capture());
    SuccessfulMatchStateController successfulMatchStateController = new SuccessfulMatchStateController(argumentCaptor.getValue(), responseFromHubFactory, identityProvidersConfigProxy);
    final ResponseProcessingDetails responseProcessingDetails = successfulMatchStateController.getResponseProcessingDetails();
    assertThat(responseProcessingDetails.getResponseProcessingStatus()).isEqualTo(ResponseProcessingStatus.SEND_SUCCESSFUL_MATCH_RESPONSE_TO_TRANSACTION);
    assertThat(responseProcessingDetails.getSessionId()).isEqualTo(state.getSessionId());
}
Also used : NoMatchFromMatchingService(uk.gov.ida.hub.policy.domain.NoMatchFromMatchingService) MatchFromMatchingServiceBuilder.aMatchFromMatchingService(uk.gov.ida.hub.policy.builder.domain.MatchFromMatchingServiceBuilder.aMatchFromMatchingService) MatchFromMatchingService(uk.gov.ida.hub.policy.domain.MatchFromMatchingService) ResponseProcessingDetails(uk.gov.ida.hub.policy.domain.ResponseProcessingDetails) SuccessfulMatchState(uk.gov.ida.hub.policy.domain.state.SuccessfulMatchState) IdentityProvidersConfigProxy(uk.gov.ida.hub.policy.proxy.IdentityProvidersConfigProxy) Test(org.junit.Test)

Example 2 with SuccessfulMatchState

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

the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInSuccessfulMatchState.

@Test
public void shouldReturnErrorResponseWhenAskedAndInSuccessfulMatchState() {
    SuccessfulMatchState state = SuccessfulMatchStateBuilder.aSuccessfulMatchState().build();
    StateController stateController = new SuccessfulMatchStateController(state, responseFromHubFactory, identityProvidersConfigProxy);
    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) SuccessfulMatchState(uk.gov.ida.hub.policy.domain.state.SuccessfulMatchState) ResponseFromHub(uk.gov.ida.hub.policy.domain.ResponseFromHub) Test(org.junit.Test)

Example 3 with SuccessfulMatchState

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

the class TestSessionResourceHelper method createSessionInSuccessfulMatchState.

public static Response createSessionInSuccessfulMatchState(SessionId sessionId, String requestIssuerEntityId, String idpEntityId, Client client, URI uri) {
    SuccessfulMatchState successfulMatchState = aSuccessfulMatchState().withSessionId(sessionId).withIdentityProviderEntityId(idpEntityId).withRequestIssuerEntityId(requestIssuerEntityId).build();
    TestSessionDto testSessionDto = createASuccessfulMatchStateTestSessionDto(successfulMatchState, sessionId);
    return client.target(uri).request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(testSessionDto));
}
Also used : AbstractSuccessfulMatchState(uk.gov.ida.hub.policy.domain.state.AbstractSuccessfulMatchState) EidasSuccessfulMatchState(uk.gov.ida.hub.policy.domain.state.EidasSuccessfulMatchState) SuccessfulMatchState(uk.gov.ida.hub.policy.domain.state.SuccessfulMatchState) SuccessfulMatchStateBuilder.aSuccessfulMatchState(uk.gov.ida.hub.policy.builder.state.SuccessfulMatchStateBuilder.aSuccessfulMatchState) EidasSuccessfulMatchStateBuilder.aEidasSuccessfulMatchState(uk.gov.ida.hub.policy.builder.state.EidasSuccessfulMatchStateBuilder.aEidasSuccessfulMatchState)

Aggregations

SuccessfulMatchState (uk.gov.ida.hub.policy.domain.state.SuccessfulMatchState)3 Test (org.junit.Test)2 MatchFromMatchingServiceBuilder.aMatchFromMatchingService (uk.gov.ida.hub.policy.builder.domain.MatchFromMatchingServiceBuilder.aMatchFromMatchingService)1 EidasSuccessfulMatchStateBuilder.aEidasSuccessfulMatchState (uk.gov.ida.hub.policy.builder.state.EidasSuccessfulMatchStateBuilder.aEidasSuccessfulMatchState)1 SuccessfulMatchStateBuilder.aSuccessfulMatchState (uk.gov.ida.hub.policy.builder.state.SuccessfulMatchStateBuilder.aSuccessfulMatchState)1 MatchFromMatchingService (uk.gov.ida.hub.policy.domain.MatchFromMatchingService)1 NoMatchFromMatchingService (uk.gov.ida.hub.policy.domain.NoMatchFromMatchingService)1 ResponseFromHub (uk.gov.ida.hub.policy.domain.ResponseFromHub)1 ResponseProcessingDetails (uk.gov.ida.hub.policy.domain.ResponseProcessingDetails)1 StateController (uk.gov.ida.hub.policy.domain.StateController)1 AbstractSuccessfulMatchState (uk.gov.ida.hub.policy.domain.state.AbstractSuccessfulMatchState)1 EidasSuccessfulMatchState (uk.gov.ida.hub.policy.domain.state.EidasSuccessfulMatchState)1 IdentityProvidersConfigProxy (uk.gov.ida.hub.policy.proxy.IdentityProvidersConfigProxy)1