use of uk.gov.ida.hub.policy.proxy.AttributeQueryRequest in project verify-hub by alphagov.
the class AttributeQueryServiceTest method shouldGenerateEidasAttributeQueryAndSendRequestToMatchingService.
@Test
public void shouldGenerateEidasAttributeQueryAndSendRequestToMatchingService() {
final EidasAttributeQueryRequestDto eidasAttributeQueryRequestDto = anEidasAttributeQueryRequestDto().build();
final AttributeQueryContainerDto attributeQueryContainerDto = anAttributeQueryContainerDto().build();
final AttributeQueryRequest attributeQueryRequest = new AttributeQueryRequest(attributeQueryContainerDto.getId(), attributeQueryContainerDto.getIssuer(), attributeQueryContainerDto.getSamlRequest(), attributeQueryContainerDto.getMatchingServiceUri(), attributeQueryContainerDto.getAttributeQueryClientTimeOut(), eidasAttributeQueryRequestDto.isOnboarding());
when(samlEngineProxy.generateEidasAttributeQuery(eidasAttributeQueryRequestDto)).thenReturn(attributeQueryContainerDto);
service.sendAttributeQueryRequest(sessionId, eidasAttributeQueryRequestDto);
verify(samlEngineProxy).generateEidasAttributeQuery(eidasAttributeQueryRequestDto);
verify(samlSoapProxyProxy).sendHubMatchingServiceRequest(sessionId, attributeQueryRequest);
}
use of uk.gov.ida.hub.policy.proxy.AttributeQueryRequest in project verify-hub by alphagov.
the class EidasSessionResourceContractTest method assertThatAQRReceivedBySamlSoapProxyHasSameDataAsSamlEngineSent.
private void assertThatAQRReceivedBySamlSoapProxyHasSameDataAsSamlEngineSent() throws Exception {
RecordedRequest request = samlSoapProxyProxyStub.getLastRequest();
assertThat(samlSoapProxyProxyStub.getCountOfRequests()).isEqualTo(1);
assertThat(request.getPath()).isEqualTo(Urls.SamlSoapProxyUrls.MATCHING_SERVICE_REQUEST_SENDER_RESOURCE);
String unzipped = IOUtils.toString(new GZIPInputStream(new ByteArrayInputStream(request.getEntityBytes())));
AttributeQueryRequest aqr = policy.getObjectMapper().readValue(unzipped, AttributeQueryRequest.class);
assertThat(aqr.getSamlRequest()).isEqualTo(SAML_ATTRIBUTE_QUERY);
assertThat(aqr.getMatchingServiceUri().toASCIIString()).isEqualTo(MATCHING_SERVICE_URI);
assertThat(aqr.getId()).isEqualTo(ID);
assertThat(aqr.getIssuer()).isEqualTo(EIDAS_HUB_ENTITY_ID);
assertThat(aqr.isOnboarding()).isTrue();
}
use of uk.gov.ida.hub.policy.proxy.AttributeQueryRequest in project verify-hub by alphagov.
the class AttributeQueryService method generateAndSendMatchingServiceRequest.
private void generateAndSendMatchingServiceRequest(final SessionId sessionId, final boolean isOnBoarding, final AttributeQueryContainerDto attributeQueryContainerDto) {
AttributeQueryRequest attributeQueryRequest = new AttributeQueryRequest(attributeQueryContainerDto.getId(), attributeQueryContainerDto.getIssuer(), attributeQueryContainerDto.getSamlRequest(), attributeQueryContainerDto.getMatchingServiceUri(), attributeQueryContainerDto.getAttributeQueryClientTimeOut(), isOnBoarding);
samlSoapProxyProxy.sendHubMatchingServiceRequest(sessionId, attributeQueryRequest);
}
Aggregations