Search in sources :

Example 6 with EidasAttributeQueryRequestDto

use of uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto in project verify-hub by alphagov.

the class AuthnResponseFromCountryService method getEidasAttributeQueryRequestDto.

private EidasAttributeQueryRequestDto getEidasAttributeQueryRequestDto(CountrySelectedStateController stateController, InboundResponseFromCountry response) {
    final String matchingServiceEntityId = stateController.getMatchingServiceEntityId();
    MatchingServiceConfigEntityDataDto matchingServiceConfig = matchingServiceConfigProxy.getMatchingService(matchingServiceEntityId);
    return new EidasAttributeQueryRequestDto(stateController.getRequestId(), stateController.getRequestIssuerEntityId(), stateController.getAssertionConsumerServiceUri(), assertionRestrictionFactory.getAssertionExpiry(), matchingServiceEntityId, matchingServiceConfig.getUri(), DateTime.now().plus(policyConfiguration.getMatchingServiceResponseWaitPeriod()), matchingServiceConfig.isOnboarding(), response.getLevelOfAssurance().get(), new PersistentId(response.getPersistentId().get()), Optional.absent(), Optional.absent(), response.getEncryptedIdentityAssertionBlob().get());
}
Also used : MatchingServiceConfigEntityDataDto(uk.gov.ida.hub.policy.contracts.MatchingServiceConfigEntityDataDto) EidasAttributeQueryRequestDto(uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto) PersistentId(uk.gov.ida.hub.policy.domain.PersistentId)

Example 7 with EidasAttributeQueryRequestDto

use of uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto 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)

Example 8 with EidasAttributeQueryRequestDto

use of uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto in project verify-hub by alphagov.

the class EidasAwaitingCycle3DataStateController method createAttributeQuery.

@Override
public EidasAttributeQueryRequestDto createAttributeQuery(final Cycle3Dataset cycle3Dataset) {
    MatchingServiceConfigEntityDataDto matchingServiceConfigData = getMatchingServiceConfigProxy().getMatchingService(getState().getMatchingServiceEntityId());
    URI matchingServiceAdapterUri = matchingServiceConfigData.getUri();
    return new EidasAttributeQueryRequestDto(getState().getRequestId(), getState().getRequestIssuerEntityId(), getState().getAssertionConsumerServiceUri(), getAssertionRestrictionsFactory().getAssertionExpiry(), getState().getMatchingServiceEntityId(), matchingServiceAdapterUri, DateTime.now().plus(getPolicyConfiguration().getMatchingServiceResponseWaitPeriod()), matchingServiceConfigData.isOnboarding(), getState().getLevelOfAssurance(), getState().getPersistentId(), Optional.fromNullable(cycle3Dataset), Optional.absent(), getState().getEncryptedIdentityAssertion());
}
Also used : MatchingServiceConfigEntityDataDto(uk.gov.ida.hub.policy.contracts.MatchingServiceConfigEntityDataDto) URI(java.net.URI) EidasAttributeQueryRequestDto(uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto)

Aggregations

EidasAttributeQueryRequestDto (uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto)8 Test (org.junit.Test)5 MatchingServiceConfigEntityDataDto (uk.gov.ida.hub.policy.contracts.MatchingServiceConfigEntityDataDto)3 Cycle3Dataset (uk.gov.ida.hub.policy.domain.Cycle3Dataset)3 EidasAttributeQueryRequestDtoBuilder.anEidasAttributeQueryRequestDto (uk.gov.ida.hub.policy.builder.EidasAttributeQueryRequestDtoBuilder.anEidasAttributeQueryRequestDto)2 AttributeQueryContainerDto (uk.gov.ida.hub.policy.contracts.AttributeQueryContainerDto)2 PersistentId (uk.gov.ida.hub.policy.domain.PersistentId)2 SessionId (uk.gov.ida.hub.policy.domain.SessionId)2 URI (java.net.URI)1 HashMap (java.util.HashMap)1 AttributeQueryContainerDtoBuilder.anAttributeQueryContainerDto (uk.gov.ida.hub.policy.builder.AttributeQueryContainerDtoBuilder.anAttributeQueryContainerDto)1 MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto (uk.gov.ida.hub.policy.builder.MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto)1 SamlAuthnResponseTranslatorDto (uk.gov.ida.hub.policy.contracts.SamlAuthnResponseTranslatorDto)1 Cycle3AttributeRequestData (uk.gov.ida.hub.policy.domain.Cycle3AttributeRequestData)1 InboundResponseFromCountry (uk.gov.ida.hub.policy.domain.InboundResponseFromCountry)1 CountrySelectedStateController (uk.gov.ida.hub.policy.domain.controller.CountrySelectedStateController)1 CountrySelectedState (uk.gov.ida.hub.policy.domain.state.CountrySelectedState)1 EidasCycle0And1MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.EidasCycle0And1MatchRequestSentState)1 AttributeQueryRequest (uk.gov.ida.hub.policy.proxy.AttributeQueryRequest)1