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