use of uk.gov.ida.hub.policy.domain.state.Cycle0And1MatchRequestSentState in project verify-hub by alphagov.
the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInCycle0And1MatchRequestSentState.
@Test
public void shouldReturnErrorResponseWhenAskedAndInCycle0And1MatchRequestSentState() {
Cycle0And1MatchRequestSentState state = Cycle0And1MatchRequestSentStateBuilder.aCycle0And1MatchRequestSentState().build();
StateController stateController = new Cycle0And1MatchRequestSentStateController(state, hubEventLogger, stateTransitionAction, policyConfiguration, levelOfAssuranceValidator, transactionsConfigProxy, responseFromHubFactory, assertionRestrictionFactory, matchingServiceConfigProxy, attributeQueryService);
when(sessionRepository.getStateController(sessionId, ErrorResponsePreparedState.class)).thenReturn(stateController);
ResponseFromHub responseFromHub = authnRequestFromTransactionHandler.getErrorResponseFromHub(sessionId);
assertThat(responseFromHub.getStatus()).isEqualTo(TransactionIdaStatus.NoAuthenticationContext);
}
use of uk.gov.ida.hub.policy.domain.state.Cycle0And1MatchRequestSentState in project verify-hub by alphagov.
the class IdpSelectedStateControllerTest method handleSuccessResponseFromIdp_shouldTransitionToCycle0And1MatchRequestSentState.
@Test
public void handleSuccessResponseFromIdp_shouldTransitionToCycle0And1MatchRequestSentState() {
ArgumentCaptor<Cycle0And1MatchRequestSentState> stateArgumentCaptor = ArgumentCaptor.forClass(Cycle0And1MatchRequestSentState.class);
PersistentId persistentId = aPersistentId().withNameId("idname").build();
final String encryptedMatchingDatasetAssertion = "blah";
SuccessFromIdp successFromIdp = aSuccessFromIdp().withIssuerId(IDP_ENTITY_ID).withPersistentId(persistentId).withPrincipalIpAddressSeenByIdp(PRINCIPAL_IP_ADDRESS_AS_SEEN_BY_IDP).withPrincipalIpAddressAsSeenByHub(PRINCIPAL_IP_ADDRESS_AS_SEEN_BY_HUB).withLevelOfAssurance(PROVIDED_LOA).withEncryptedMatchingDatasetAssertion(encryptedMatchingDatasetAssertion).build();
when(identityProvidersConfigProxy.getEnabledIdentityProviders(TRANSACTION_ENTITY_ID, controller.isRegistrationContext(), PROVIDED_LOA)).thenReturn(singletonList(IDP_ENTITY_ID));
when(policyConfiguration.getMatchingServiceResponseWaitPeriod()).thenReturn(new org.joda.time.Duration(600L));
when(identityProvidersConfigProxy.getIdpConfig(IDP_ENTITY_ID)).thenReturn(anIdpConfigDto().withLevelsOfAssurance(LEVELS_OF_ASSURANCE).build());
controller.handleSuccessResponseFromIdp(successFromIdp);
verify(stateTransitionAction).transitionTo(stateArgumentCaptor.capture());
assertThat(stateArgumentCaptor.getValue()).isInstanceOf(Cycle0And1MatchRequestSentState.class);
assertThat(stateArgumentCaptor.getValue().getEncryptedMatchingDatasetAssertion()).isEqualTo(encryptedMatchingDatasetAssertion);
}
use of uk.gov.ida.hub.policy.domain.state.Cycle0And1MatchRequestSentState in project verify-hub by alphagov.
the class IdpSelectedStateController method createCycle0And1MatchRequestSentState.
private State createCycle0And1MatchRequestSentState(SuccessFromIdp successFromIdp) {
String authnStatementAssertion = successFromIdp.getAuthnStatementAssertion();
String matchingServiceEntityId = getMatchingServiceEntityId();
return new Cycle0And1MatchRequestSentState(state.getRequestId(), state.getRequestIssuerEntityId(), state.getSessionExpiryTimestamp(), state.getAssertionConsumerServiceUri(), new SessionId(state.getSessionId().getSessionId()), state.getTransactionSupportsEidas(), state.isRegistering(), successFromIdp.getIssuer(), state.getRelayState().orNull(), successFromIdp.getLevelOfAssurance(), matchingServiceEntityId, successFromIdp.getEncryptedMatchingDatasetAssertion(), authnStatementAssertion, successFromIdp.getPersistentId());
}
Aggregations