Search in sources :

Example 1 with MatchingServiceConfigEntityDataDto

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

the class ConfigStubRule method setUpStubForMatchingServiceRequest.

public void setUpStubForMatchingServiceRequest(String rpEntityId, String matchingServiceEntityId, boolean isOnboarding) throws JsonProcessingException {
    String uri = UriBuilder.fromPath(Urls.ConfigUrls.MATCHING_SERVICE_ENTITY_ID_RESOURCE).build(StringEncoding.urlEncode(rpEntityId).replace("+", "%20")).getPath();
    register(uri, OK, ContentType.TEXT_PLAIN.toString(), matchingServiceEntityId);
    String msaUri = UriBuilder.fromPath(Urls.ConfigUrls.MATCHING_SERVICE_RESOURCE).build(StringEncoding.urlEncode(matchingServiceEntityId).replace("+", "%20")).getPath();
    MatchingServiceConfigEntityDataDto matchingServiceUri = new MatchingServiceConfigEntityDataDto(matchingServiceEntityId, URI.create("matchingServiceUri"), rpEntityId, false, isOnboarding, null);
    register(msaUri, OK, matchingServiceUri);
}
Also used : MatchingServiceConfigEntityDataDto(uk.gov.ida.hub.policy.contracts.MatchingServiceConfigEntityDataDto)

Example 2 with MatchingServiceConfigEntityDataDto

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

the class ConfigStubExtension method setUpStubForMatchingServiceRequest.

public void setUpStubForMatchingServiceRequest(String rpEntityId, String matchingServiceEntityId, boolean isOnboarding) throws JsonProcessingException {
    String uri = UriBuilder.fromPath(Urls.ConfigUrls.MATCHING_SERVICE_ENTITY_ID_RESOURCE).build(StringEncoding.urlEncode(rpEntityId).replace("+", "%20")).getPath();
    register(uri, OK, ContentType.TEXT_PLAIN.toString(), matchingServiceEntityId);
    String isUsingMatchingUri = UriBuilder.fromPath(Urls.ConfigUrls.MATCHING_ENABLED_FOR_TRANSACTION_RESOURCE).buildFromEncoded(StringEncoding.urlEncode(rpEntityId).replace("+", "%20")).getPath();
    register(isUsingMatchingUri, OK, ContentType.APPLICATION_JSON.toString(), "true");
    String msaUri = UriBuilder.fromPath(Urls.ConfigUrls.MATCHING_SERVICE_RESOURCE).build(StringEncoding.urlEncode(matchingServiceEntityId).replace("+", "%20")).getPath();
    MatchingServiceConfigEntityDataDto matchingServiceUri = new MatchingServiceConfigEntityDataDto(matchingServiceEntityId, URI.create("matchingServiceUri"), rpEntityId, false, isOnboarding, null);
    register(msaUri, OK, matchingServiceUri);
}
Also used : MatchingServiceConfigEntityDataDto(uk.gov.ida.hub.policy.contracts.MatchingServiceConfigEntityDataDto)

Example 3 with MatchingServiceConfigEntityDataDto

use of uk.gov.ida.hub.policy.contracts.MatchingServiceConfigEntityDataDto 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 4 with MatchingServiceConfigEntityDataDto

use of uk.gov.ida.hub.policy.contracts.MatchingServiceConfigEntityDataDto 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 5 with MatchingServiceConfigEntityDataDto

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

MatchingServiceConfigEntityDataDto (uk.gov.ida.hub.policy.contracts.MatchingServiceConfigEntityDataDto)7 EidasAttributeQueryRequestDto (uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto)3 URI (java.net.URI)2 Test (org.junit.Test)1 MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto (uk.gov.ida.hub.policy.builder.MatchingServiceConfigEntityDataDtoBuilder.aMatchingServiceConfigEntityDataDto)1 Cycle3Dataset (uk.gov.ida.hub.policy.domain.Cycle3Dataset)1 PersistentId (uk.gov.ida.hub.policy.domain.PersistentId)1