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);
}
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);
}
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());
}
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);
}
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());
}
Aggregations