Search in sources :

Example 1 with EidasCycle0And1MatchRequestSentState

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

the class EidasCycle0And1MatchRequestSentStateBuilderTest method withPersistentId.

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

Example 2 with EidasCycle0And1MatchRequestSentState

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

the class EidasCycle0And1MatchRequestSentStateBuilderTest method withEncryptedIdentityAssertion.

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

Example 3 with EidasCycle0And1MatchRequestSentState

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

the class CountrySelectedStateControllerTest method shouldTransitionToEidasCycle0And1MatchRequestSentState.

@Test
public void shouldTransitionToEidasCycle0And1MatchRequestSentState() {
    final String ipAddress = "ip-address";
    when(transactionsConfigProxy.getMatchingServiceEntityId(state.getRequestIssuerEntityId())).thenReturn(MSA_ID);
    EidasAttributeQueryRequestDto eidasAttributeQueryRequestDto = anEidasAttributeQueryRequestDto().build();
    EidasCycle0And1MatchRequestSentState eidasCycle0And1MatchRequestSentState = new EidasCycle0And1MatchRequestSentState(state.getRequestId(), state.getRequestIssuerEntityId(), state.getSessionExpiryTimestamp(), state.getAssertionConsumerServiceUri(), new SessionId(state.getSessionId().getSessionId()), state.getTransactionSupportsEidas(), COUNTRY_ENTITY_ID, state.getRelayState().orNull(), eidasAttributeQueryRequestDto.getLevelOfAssurance(), MSA_ID, eidasAttributeQueryRequestDto.getEncryptedIdentityAssertion(), eidasAttributeQueryRequestDto.getPersistentId());
    controller.transitionToEidasCycle0And1MatchRequestSentState(eidasAttributeQueryRequestDto, ipAddress, COUNTRY_ENTITY_ID);
    verify(hubEventLogger).logIdpAuthnSucceededEvent(state.getSessionId(), state.getSessionExpiryTimestamp(), state.getCountryEntityId(), state.getRequestIssuerEntityId(), eidasAttributeQueryRequestDto.getPersistentId(), state.getRequestId(), state.getLevelsOfAssurance().get(0), state.getLevelsOfAssurance().get(state.getLevelsOfAssurance().size() - 1), eidasAttributeQueryRequestDto.getLevelOfAssurance(), com.google.common.base.Optional.absent(), ipAddress);
    verify(stateTransitionAction).transitionTo(eidasCycle0And1MatchRequestSentState);
}
Also used : EidasCycle0And1MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.EidasCycle0And1MatchRequestSentState) SessionId(uk.gov.ida.hub.policy.domain.SessionId) EidasAttributeQueryRequestDtoBuilder.anEidasAttributeQueryRequestDto(uk.gov.ida.hub.policy.builder.EidasAttributeQueryRequestDtoBuilder.anEidasAttributeQueryRequestDto) EidasAttributeQueryRequestDto(uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto) Test(org.junit.Test)

Example 4 with EidasCycle0And1MatchRequestSentState

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

the class EidasCycle0And1MatchRequestSentStateBuilderTest method build.

@Test
public void build() {
    EidasCycle0And1MatchRequestSentState state = EidasCycle0And1MatchRequestSentStateBuilder.anEidasCycle0And1MatchRequestSentState().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 : EidasCycle0And1MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.EidasCycle0And1MatchRequestSentState) SessionId(uk.gov.ida.hub.policy.domain.SessionId) PersistentId(uk.gov.ida.hub.policy.domain.PersistentId) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 EidasCycle0And1MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.EidasCycle0And1MatchRequestSentState)4 SessionId (uk.gov.ida.hub.policy.domain.SessionId)2 EidasAttributeQueryRequestDtoBuilder.anEidasAttributeQueryRequestDto (uk.gov.ida.hub.policy.builder.EidasAttributeQueryRequestDtoBuilder.anEidasAttributeQueryRequestDto)1 EidasAttributeQueryRequestDto (uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto)1 PersistentId (uk.gov.ida.hub.policy.domain.PersistentId)1