Search in sources :

Example 1 with AttributeQueryRequest

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);
}
Also used : AttributeQueryContainerDto(uk.gov.ida.hub.policy.contracts.AttributeQueryContainerDto) AttributeQueryContainerDtoBuilder.anAttributeQueryContainerDto(uk.gov.ida.hub.policy.builder.AttributeQueryContainerDtoBuilder.anAttributeQueryContainerDto) AttributeQueryRequest(uk.gov.ida.hub.policy.proxy.AttributeQueryRequest) EidasAttributeQueryRequestDtoBuilder.anEidasAttributeQueryRequestDto(uk.gov.ida.hub.policy.builder.EidasAttributeQueryRequestDtoBuilder.anEidasAttributeQueryRequestDto) EidasAttributeQueryRequestDto(uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto) Test(org.junit.Test)

Example 2 with 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();
}
Also used : RecordedRequest(httpstub.RecordedRequest) GZIPInputStream(java.util.zip.GZIPInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) AttributeQueryRequest(uk.gov.ida.hub.policy.proxy.AttributeQueryRequest)

Example 3 with AttributeQueryRequest

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);
}
Also used : AttributeQueryRequest(uk.gov.ida.hub.policy.proxy.AttributeQueryRequest)

Aggregations

AttributeQueryRequest (uk.gov.ida.hub.policy.proxy.AttributeQueryRequest)3 RecordedRequest (httpstub.RecordedRequest)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 GZIPInputStream (java.util.zip.GZIPInputStream)1 Test (org.junit.Test)1 AttributeQueryContainerDtoBuilder.anAttributeQueryContainerDto (uk.gov.ida.hub.policy.builder.AttributeQueryContainerDtoBuilder.anAttributeQueryContainerDto)1 EidasAttributeQueryRequestDtoBuilder.anEidasAttributeQueryRequestDto (uk.gov.ida.hub.policy.builder.EidasAttributeQueryRequestDtoBuilder.anEidasAttributeQueryRequestDto)1 AttributeQueryContainerDto (uk.gov.ida.hub.policy.contracts.AttributeQueryContainerDto)1 EidasAttributeQueryRequestDto (uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto)1