Search in sources :

Example 1 with Cycle3Dataset

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

the class Cycle3Service method sendCycle3MatchingRequest.

public void sendCycle3MatchingRequest(SessionId sessionId, Cycle3UserInput cycle3UserInput) {
    AbstractAwaitingCycle3DataStateController controller = (AbstractAwaitingCycle3DataStateController) sessionRepository.getStateController(sessionId, AbstractAwaitingCycle3DataState.class);
    String attributeName = controller.getCycle3AttributeRequestData().getAttributeName();
    Cycle3Dataset cycle3Dataset = Cycle3Dataset.createFromData(attributeName, cycle3UserInput.getCycle3Input());
    AbstractAttributeQueryRequestDto attributeQuery = controller.createAttributeQuery(cycle3Dataset);
    attributeQueryService.sendAttributeQueryRequest(sessionId, attributeQuery);
    controller.handleCycle3DataSubmitted(cycle3UserInput.getPrincipalIpAddress());
}
Also used : AbstractAwaitingCycle3DataState(uk.gov.ida.hub.policy.domain.state.AbstractAwaitingCycle3DataState) Cycle3Dataset(uk.gov.ida.hub.policy.domain.Cycle3Dataset) AbstractAwaitingCycle3DataStateController(uk.gov.ida.hub.policy.domain.controller.AbstractAwaitingCycle3DataStateController) AbstractAttributeQueryRequestDto(uk.gov.ida.hub.policy.contracts.AbstractAttributeQueryRequestDto)

Example 2 with Cycle3Dataset

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

the class EidasAttributeQueryRequestDtoBuilderTest method build.

@Test
public void build() throws Exception {
    Map<String, String> map = new HashMap<>();
    map.put("attribute", "attributeValue");
    EidasAttributeQueryRequestDto eidasAttributeQueryRequestDto = EidasAttributeQueryRequestDtoBuilder.anEidasAttributeQueryRequestDto().build();
    assertThat(eidasAttributeQueryRequestDto.getRequestId()).isEqualTo("requestId");
    assertThat(eidasAttributeQueryRequestDto.getPersistentId()).isEqualTo(new PersistentId("nameId"));
    assertThat(eidasAttributeQueryRequestDto.getEncryptedIdentityAssertion()).isEqualTo("encryptedIdentityAssertion");
    assertThat(eidasAttributeQueryRequestDto.getAssertionConsumerServiceUri()).isEqualTo(URI.create("assertionConsumerServiceUri"));
    assertThat(eidasAttributeQueryRequestDto.getAuthnRequestIssuerEntityId()).isEqualTo("authnRequestIssuesEntityId");
    assertThat(eidasAttributeQueryRequestDto.getLevelOfAssurance()).isEqualTo(LevelOfAssurance.LEVEL_2);
    assertThat(eidasAttributeQueryRequestDto.getAttributeQueryUri()).isEqualTo(URI.create("matchingServiceAdapterUri"));
    assertThat(eidasAttributeQueryRequestDto.getMatchingServiceEntityId()).isEqualTo("matchingServiceAdapterEntityId");
    assertThat(eidasAttributeQueryRequestDto.getMatchingServiceRequestTimeOut()).isEqualTo(DateTime.now().plusHours(1));
    assertThat(eidasAttributeQueryRequestDto.isOnboarding()).isTrue();
    assertThat(eidasAttributeQueryRequestDto.getCycle3Dataset()).isEqualTo(Optional.of(new Cycle3Dataset(map)));
    assertThat(eidasAttributeQueryRequestDto.getUserAccountCreationAttributes()).isEqualTo(Optional.absent());
    assertThat(eidasAttributeQueryRequestDto.getAssertionExpiry()).isEqualTo(DateTime.now().plusHours(2));
}
Also used : Cycle3Dataset(uk.gov.ida.hub.policy.domain.Cycle3Dataset) HashMap(java.util.HashMap) EidasAttributeQueryRequestDto(uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto) PersistentId(uk.gov.ida.hub.policy.domain.PersistentId) Test(org.junit.Test)

Example 3 with Cycle3Dataset

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

the class EidasAwaitingCycle3DataStateControllerTest method createAttributeQuery.

@Test
public void createAttributeQuery() {
    final Cycle3Dataset cycle3Dataset = Cycle3Dataset.createFromData("attribute", "attributeValue");
    final MatchingServiceConfigEntityDataDto matchingServiceConfigEntityDataDto = aMatchingServiceConfigEntityDataDto().withEntityId(state.getMatchingServiceEntityId()).build();
    when(matchingServiceConfigProxy.getMatchingService(state.getMatchingServiceEntityId())).thenReturn(matchingServiceConfigEntityDataDto);
    when(policyConfiguration.getMatchingServiceResponseWaitPeriod()).thenReturn(Duration.standardMinutes(60));
    when(assertionRestrictionsFactory.getAssertionExpiry()).thenReturn(DateTime.now().plusHours(2));
    final EidasAttributeQueryRequestDto expectedDto = new EidasAttributeQueryRequestDto(state.getRequestId(), state.getRequestIssuerEntityId(), state.getAssertionConsumerServiceUri(), assertionRestrictionsFactory.getAssertionExpiry(), state.getMatchingServiceEntityId(), matchingServiceConfigEntityDataDto.getUri(), DateTime.now().plus(policyConfiguration.getMatchingServiceResponseWaitPeriod()), matchingServiceConfigEntityDataDto.isOnboarding(), state.getLevelOfAssurance(), state.getPersistentId(), Optional.of(cycle3Dataset), Optional.absent(), state.getEncryptedIdentityAssertion());
    EidasAttributeQueryRequestDto actualDto = controller.createAttributeQuery(cycle3Dataset);
    assertThat(actualDto).isEqualTo(expectedDto);
}
Also used : MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto(uk.gov.ida.hub.policy.builder.MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto) MatchingServiceConfigEntityDataDto(uk.gov.ida.hub.policy.contracts.MatchingServiceConfigEntityDataDto) Cycle3Dataset(uk.gov.ida.hub.policy.domain.Cycle3Dataset) EidasAttributeQueryRequestDto(uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto) Test(org.junit.Test)

Aggregations

Cycle3Dataset (uk.gov.ida.hub.policy.domain.Cycle3Dataset)3 Test (org.junit.Test)2 EidasAttributeQueryRequestDto (uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto)2 HashMap (java.util.HashMap)1 MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto (uk.gov.ida.hub.policy.builder.MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto)1 AbstractAttributeQueryRequestDto (uk.gov.ida.hub.policy.contracts.AbstractAttributeQueryRequestDto)1 MatchingServiceConfigEntityDataDto (uk.gov.ida.hub.policy.contracts.MatchingServiceConfigEntityDataDto)1 PersistentId (uk.gov.ida.hub.policy.domain.PersistentId)1 AbstractAwaitingCycle3DataStateController (uk.gov.ida.hub.policy.domain.controller.AbstractAwaitingCycle3DataStateController)1 AbstractAwaitingCycle3DataState (uk.gov.ida.hub.policy.domain.state.AbstractAwaitingCycle3DataState)1