Search in sources :

Example 1 with EidasCycle3MatchRequestSentState

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

the class EidasCycle3MatchRequestSentStateBuilderTest method withPersistentId.

@Test
public void withPersistentId() {
    EidasCycle3MatchRequestSentState state = EidasCycle3MatchRequestSentStateBuilder.anEidasCycle3MatchRequestSentState().withPersistentId(DIFFERENT_NAME_ID).build();
    assertThat(state.getPersistentId()).isEqualTo(DIFFERENT_NAME_ID);
}
Also used : EidasCycle3MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.EidasCycle3MatchRequestSentState) Test(org.junit.Test)

Example 2 with EidasCycle3MatchRequestSentState

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

the class EidasAwaitingCycle3DataStateControllerTest method shouldTransitionToEidasCycle3MatchRequestSentState.

@Test
public void shouldTransitionToEidasCycle3MatchRequestSentState() {
    final String principalIpAddressAsSeenByHub = "principalIpAddressAsSeenByHub";
    doNothing().when(hubEventLogger).logCycle3DataObtained(state.getSessionId(), state.getRequestIssuerEntityId(), state.getSessionExpiryTimestamp(), state.getRequestId(), principalIpAddressAsSeenByHub);
    final EidasCycle3MatchRequestSentState expectedState = new EidasCycle3MatchRequestSentState(state.getRequestId(), state.getRequestIssuerEntityId(), state.getSessionExpiryTimestamp(), state.getAssertionConsumerServiceUri(), state.getSessionId(), state.getTransactionSupportsEidas(), state.getIdentityProviderEntityId(), state.getRelayState().orNull(), state.getLevelOfAssurance(), state.getMatchingServiceEntityId(), state.getEncryptedIdentityAssertion(), state.getPersistentId());
    controller.handleCycle3DataSubmitted(principalIpAddressAsSeenByHub);
    verify(stateTransitionAction).transitionTo(expectedState);
}
Also used : EidasCycle3MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.EidasCycle3MatchRequestSentState) Test(org.junit.Test)

Example 3 with EidasCycle3MatchRequestSentState

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

the class EidasCycle3MatchRequestSentStateBuilderTest method build.

@Test
public void build() {
    EidasCycle3MatchRequestSentState state = EidasCycle3MatchRequestSentStateBuilder.anEidasCycle3MatchRequestSentState().build();
    assertThat(state.getRequestId()).isEqualTo("requestId");
    assertThat(state.getIdentityProviderEntityId()).isEqualTo("identityProviderEntityId");
    assertThat(state.getSessionExpiryTimestamp()).isEqualTo(DateTime.now().plusMinutes(10));
    assertThat(state.getRelayState()).isEqualTo(Optional.absent());
    assertThat(state.getRequestIssuerEntityId()).isEqualTo("requestIssuerId");
    assertThat(state.getEncryptedIdentityAssertion()).isEqualTo("encryptedIdentityAssertion");
    assertThat(state.getAssertionConsumerServiceUri()).isEqualTo(URI.create("assertionConsumerServiceUri"));
    assertThat(state.getMatchingServiceAdapterEntityId()).isEqualTo("matchingServiceAdapterEntityId");
    assertThat(state.getSessionId()).isEqualTo(new SessionId("sessionId"));
    assertThat(state.getIdpLevelOfAssurance()).isEqualTo(LevelOfAssurance.LEVEL_2);
    assertThat(state.getPersistentId()).isEqualTo(new PersistentId("default-name-id"));
    assertThat(state.getTransactionSupportsEidas()).isEqualTo(true);
}
Also used : EidasCycle3MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.EidasCycle3MatchRequestSentState) SessionId(uk.gov.ida.hub.policy.domain.SessionId) PersistentId(uk.gov.ida.hub.policy.domain.PersistentId) Test(org.junit.Test)

Example 4 with EidasCycle3MatchRequestSentState

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

the class EidasCycle3MatchRequestSentStateBuilderTest method withEncryptedIdentityAssertion.

@Test
public void withEncryptedIdentityAssertion() {
    EidasCycle3MatchRequestSentState state = EidasCycle3MatchRequestSentStateBuilder.anEidasCycle3MatchRequestSentState().withEncryptedIdentityAssertion(ENCRYPTED_DIFFERENT_IDENTITY_ASSERTION).build();
    assertThat(state.getEncryptedIdentityAssertion()).isEqualTo(ENCRYPTED_DIFFERENT_IDENTITY_ASSERTION);
}
Also used : EidasCycle3MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.EidasCycle3MatchRequestSentState) Test(org.junit.Test)

Example 5 with EidasCycle3MatchRequestSentState

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

the class EidasAwaitingCycle3DataStateController method handleCycle3DataSubmitted.

@Override
public void handleCycle3DataSubmitted(final String principalIpAddressAsSeenByHub) {
    getHubEventLogger().logCycle3DataObtained(getState().getSessionId(), getState().getRequestIssuerEntityId(), getState().getSessionExpiryTimestamp(), getState().getRequestId(), principalIpAddressAsSeenByHub);
    EidasCycle3MatchRequestSentState eidasCycle3MatchRequestSentState = new EidasCycle3MatchRequestSentState(getState().getRequestId(), getState().getRequestIssuerEntityId(), getState().getSessionExpiryTimestamp(), getState().getAssertionConsumerServiceUri(), getState().getSessionId(), getState().getTransactionSupportsEidas(), getState().getIdentityProviderEntityId(), getState().getRelayState().orNull(), getState().getLevelOfAssurance(), getState().getMatchingServiceEntityId(), getState().getEncryptedIdentityAssertion(), getState().getPersistentId());
    getStateTransitionAction().transitionTo(eidasCycle3MatchRequestSentState);
}
Also used : EidasCycle3MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.EidasCycle3MatchRequestSentState)

Aggregations

EidasCycle3MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.EidasCycle3MatchRequestSentState)5 Test (org.junit.Test)4 PersistentId (uk.gov.ida.hub.policy.domain.PersistentId)1 SessionId (uk.gov.ida.hub.policy.domain.SessionId)1