Search in sources :

Example 6 with State

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

the class EidasCycle0And1MatchRequestSentStateControllerTest method shouldReturnSuccessfulMatchState.

@Test
public void shouldReturnSuccessfulMatchState() {
    MatchFromMatchingService matchFromMatchingService = new MatchFromMatchingService("issuer", "inResponseTo", "matchingServiceAssertion", Optional.of(LevelOfAssurance.LEVEL_2));
    doNothing().when(hubEventLogger).logCycle01SuccessfulMatchEvent(state.getSessionId(), state.getRequestIssuerEntityId(), state.getRequestId(), state.getSessionExpiryTimestamp());
    EidasSuccessfulMatchState expectedState = new EidasSuccessfulMatchState(state.getRequestId(), state.getSessionExpiryTimestamp(), state.getIdentityProviderEntityId(), matchFromMatchingService.getMatchingServiceAssertion(), state.getRelayState().orNull(), state.getRequestIssuerEntityId(), state.getAssertionConsumerServiceUri(), state.getSessionId(), state.getIdpLevelOfAssurance(), state.getTransactionSupportsEidas());
    State actualState = eidasCycle0And1MatchRequestSentStateController.getNextStateForMatch(matchFromMatchingService);
    assertThat(actualState).isEqualTo(expectedState);
}
Also used : EidasAwaitingCycle3DataState(uk.gov.ida.hub.policy.domain.state.EidasAwaitingCycle3DataState) NoMatchState(uk.gov.ida.hub.policy.domain.state.NoMatchState) EidasSuccessfulMatchState(uk.gov.ida.hub.policy.domain.state.EidasSuccessfulMatchState) EidasCycle0And1MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.EidasCycle0And1MatchRequestSentState) EidasCycle0And1MatchRequestSentStateBuilder.anEidasCycle0And1MatchRequestSentState(uk.gov.ida.hub.policy.builder.state.EidasCycle0And1MatchRequestSentStateBuilder.anEidasCycle0And1MatchRequestSentState) State(uk.gov.ida.hub.policy.domain.State) MatchFromMatchingService(uk.gov.ida.hub.policy.domain.MatchFromMatchingService) EidasSuccessfulMatchState(uk.gov.ida.hub.policy.domain.state.EidasSuccessfulMatchState) Test(org.junit.Test)

Example 7 with State

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

the class AbstractMatchRequestSentStateController method handleNoMatchResponseFromMatchingService.

@Override
public final void handleNoMatchResponseFromMatchingService(NoMatchFromMatchingService responseFromMatchingService) {
    validateResponse(responseFromMatchingService);
    State nextState = getNextStateForNoMatch();
    stateTransitionAction.transitionTo(nextState);
}
Also used : MatchingServiceRequestErrorState(uk.gov.ida.hub.policy.domain.state.MatchingServiceRequestErrorState) AbstractSuccessfulMatchState(uk.gov.ida.hub.policy.domain.state.AbstractSuccessfulMatchState) NoMatchState(uk.gov.ida.hub.policy.domain.state.NoMatchState) State(uk.gov.ida.hub.policy.domain.State) AbstractMatchRequestSentState(uk.gov.ida.hub.policy.domain.state.AbstractMatchRequestSentState)

Example 8 with State

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

the class AbstractMatchRequestSentStateController method handleMatchResponseFromMatchingService.

@Override
public final void handleMatchResponseFromMatchingService(MatchFromMatchingService responseFromMatchingService) {
    validateResponse(responseFromMatchingService);
    State nextState = getNextStateForMatch(responseFromMatchingService);
    stateTransitionAction.transitionTo(nextState);
}
Also used : MatchingServiceRequestErrorState(uk.gov.ida.hub.policy.domain.state.MatchingServiceRequestErrorState) AbstractSuccessfulMatchState(uk.gov.ida.hub.policy.domain.state.AbstractSuccessfulMatchState) NoMatchState(uk.gov.ida.hub.policy.domain.state.NoMatchState) State(uk.gov.ida.hub.policy.domain.State) AbstractMatchRequestSentState(uk.gov.ida.hub.policy.domain.state.AbstractMatchRequestSentState)

Example 9 with State

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

the class IdpSelectedStateControllerTest method handleResponseFromIdp_shouldTransitionToAuthnFailedStateWhenAGenericAuthenticationFailureHasOccurred.

@Test
public void handleResponseFromIdp_shouldTransitionToAuthnFailedStateWhenAGenericAuthenticationFailureHasOccurred() {
    when(identityProvidersConfigProxy.getEnabledIdentityProviders(TRANSACTION_ENTITY_ID, controller.isRegistrationContext(), PROVIDED_LOA)).thenReturn(singletonList(IDP_ENTITY_ID));
    AuthenticationErrorResponse authenticationErrorResponse = anAuthenticationErrorResponse().withIssuerId(IDP_ENTITY_ID).build();
    controller.handleAuthenticationFailedResponseFromIdp(authenticationErrorResponse);
    ArgumentCaptor<State> stateArgumentCaptor = ArgumentCaptor.forClass(State.class);
    verify(stateTransitionAction).transitionTo(stateArgumentCaptor.capture());
    assertThat(stateArgumentCaptor.getValue()).isInstanceOf(AuthnFailedErrorState.class);
}
Also used : AuthenticationErrorResponse(uk.gov.ida.hub.policy.domain.AuthenticationErrorResponse) AuthenticationErrorResponseBuilder.anAuthenticationErrorResponse(uk.gov.ida.hub.policy.builder.domain.AuthenticationErrorResponseBuilder.anAuthenticationErrorResponse) State(uk.gov.ida.hub.policy.domain.State) AuthnFailedErrorState(uk.gov.ida.hub.policy.domain.state.AuthnFailedErrorState) Cycle0And1MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.Cycle0And1MatchRequestSentState) IdpSelectedState(uk.gov.ida.hub.policy.domain.state.IdpSelectedState) FraudEventDetectedState(uk.gov.ida.hub.policy.domain.state.FraudEventDetectedState) IdpSelectedStateBuilder.anIdpSelectedState(uk.gov.ida.hub.policy.builder.state.IdpSelectedStateBuilder.anIdpSelectedState) PausedRegistrationState(uk.gov.ida.hub.policy.domain.state.PausedRegistrationState) SessionStartedState(uk.gov.ida.hub.policy.domain.state.SessionStartedState) Test(org.junit.Test)

Example 10 with State

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

the class IdpSelectedStateControllerTest method handleResponseFromIdp_shouldTransitionToAuthnFailedStateWhenFraudHasOccurred.

@Test
public void handleResponseFromIdp_shouldTransitionToAuthnFailedStateWhenFraudHasOccurred() {
    when(identityProvidersConfigProxy.getEnabledIdentityProviders(TRANSACTION_ENTITY_ID, controller.isRegistrationContext(), PROVIDED_LOA)).thenReturn(singletonList(IDP_ENTITY_ID));
    FraudFromIdp fraudFromIdp = aFraudFromIdp().withIssuerId(IDP_ENTITY_ID).withFraudDetectedDetails(new FraudDetectedDetails("id", "IT01")).build();
    controller.handleFraudResponseFromIdp(fraudFromIdp);
    ArgumentCaptor<State> stateArgumentCaptor = ArgumentCaptor.forClass(State.class);
    verify(stateTransitionAction).transitionTo(stateArgumentCaptor.capture());
    assertThat(stateArgumentCaptor.getValue()).isInstanceOf(FraudEventDetectedState.class);
}
Also used : FraudFromIdpBuilder.aFraudFromIdp(uk.gov.ida.hub.policy.builder.domain.FraudFromIdpBuilder.aFraudFromIdp) FraudFromIdp(uk.gov.ida.hub.policy.domain.FraudFromIdp) State(uk.gov.ida.hub.policy.domain.State) AuthnFailedErrorState(uk.gov.ida.hub.policy.domain.state.AuthnFailedErrorState) Cycle0And1MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.Cycle0And1MatchRequestSentState) IdpSelectedState(uk.gov.ida.hub.policy.domain.state.IdpSelectedState) FraudEventDetectedState(uk.gov.ida.hub.policy.domain.state.FraudEventDetectedState) IdpSelectedStateBuilder.anIdpSelectedState(uk.gov.ida.hub.policy.builder.state.IdpSelectedStateBuilder.anIdpSelectedState) PausedRegistrationState(uk.gov.ida.hub.policy.domain.state.PausedRegistrationState) SessionStartedState(uk.gov.ida.hub.policy.domain.state.SessionStartedState) FraudDetectedDetails(uk.gov.ida.hub.policy.domain.FraudDetectedDetails) Test(org.junit.Test)

Aggregations

State (uk.gov.ida.hub.policy.domain.State)15 Test (org.junit.Test)11 NoMatchState (uk.gov.ida.hub.policy.domain.state.NoMatchState)11 UserAccountCreationRequestSentState (uk.gov.ida.hub.policy.domain.state.UserAccountCreationRequestSentState)6 Cycle0And1MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.Cycle0And1MatchRequestSentState)5 MatchingProcess (uk.gov.ida.hub.policy.domain.MatchingProcess)4 Cycle0And1MatchRequestSentStateBuilder.aCycle0And1MatchRequestSentState (uk.gov.ida.hub.policy.builder.state.Cycle0And1MatchRequestSentStateBuilder.aCycle0And1MatchRequestSentState)3 EidasCycle0And1MatchRequestSentStateBuilder.anEidasCycle0And1MatchRequestSentState (uk.gov.ida.hub.policy.builder.state.EidasCycle0And1MatchRequestSentStateBuilder.anEidasCycle0And1MatchRequestSentState)3 UserAccountCreationAttribute (uk.gov.ida.hub.policy.domain.UserAccountCreationAttribute)3 AbstractMatchRequestSentState (uk.gov.ida.hub.policy.domain.state.AbstractMatchRequestSentState)3 AbstractSuccessfulMatchState (uk.gov.ida.hub.policy.domain.state.AbstractSuccessfulMatchState)3 AwaitingCycle3DataState (uk.gov.ida.hub.policy.domain.state.AwaitingCycle3DataState)3 EidasAwaitingCycle3DataState (uk.gov.ida.hub.policy.domain.state.EidasAwaitingCycle3DataState)3 EidasCycle0And1MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.EidasCycle0And1MatchRequestSentState)3 EidasSuccessfulMatchState (uk.gov.ida.hub.policy.domain.state.EidasSuccessfulMatchState)3 MatchingServiceRequestErrorState (uk.gov.ida.hub.policy.domain.state.MatchingServiceRequestErrorState)3 SessionStartedState (uk.gov.ida.hub.policy.domain.state.SessionStartedState)3 SuccessfulMatchState (uk.gov.ida.hub.policy.domain.state.SuccessfulMatchState)3 URI (java.net.URI)2 Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState (uk.gov.ida.hub.policy.builder.state.Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState)2