Search in sources :

Example 6 with AuthnResponseFromHubContainerDto

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

the class RpErrorResponseFromHubIntegrationTest method shouldGenerateAnErrorAuthnResponseFromHub.

@Test
public void shouldGenerateAnErrorAuthnResponseFromHub() throws Exception {
    final SessionId sessionId = aSessionIsCreated();
    SamlMessageDto samlMessageDto = new SamlMessageDto("saml");
    samlEngineStub.setUpStubForErrorResponseGenerate(samlMessageDto);
    URI uri = UriBuilder.fromPath(Urls.PolicyUrls.RP_ERROR_RESPONSE_RESOURCE).build(sessionId.getSessionId());
    Response response = get(uri);
    assertThat(response.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
    AuthnResponseFromHubContainerDto authnResponseFromHubContainerDto = response.readEntity(AuthnResponseFromHubContainerDto.class);
    assertThat(authnResponseFromHubContainerDto.getSamlResponse()).isEqualTo(samlMessageDto.getSamlMessage());
}
Also used : Response(javax.ws.rs.core.Response) AuthnResponseFromHubContainerDto(uk.gov.ida.hub.policy.contracts.AuthnResponseFromHubContainerDto) SamlMessageDto(uk.gov.ida.hub.policy.contracts.SamlMessageDto) SessionId(uk.gov.ida.hub.policy.domain.SessionId) URI(java.net.URI) Test(org.junit.Test)

Aggregations

AuthnResponseFromHubContainerDto (uk.gov.ida.hub.policy.contracts.AuthnResponseFromHubContainerDto)6 Test (org.junit.Test)5 SessionId (uk.gov.ida.hub.policy.domain.SessionId)5 URI (java.net.URI)3 Response (javax.ws.rs.core.Response)3 SamlMessageDto (uk.gov.ida.hub.policy.contracts.SamlMessageDto)3 ResponseFromHub (uk.gov.ida.hub.policy.domain.ResponseFromHub)3 AuthnResponseFromHubContainerDtoBuilder.anAuthnResponseFromHubContainerDto (uk.gov.ida.hub.policy.builder.AuthnResponseFromHubContainerDtoBuilder.anAuthnResponseFromHubContainerDto)2 SessionId.createNewSessionId (uk.gov.ida.hub.policy.domain.SessionId.createNewSessionId)2 AuthnResponseFromHubContainerDtoBuilder.anAuthnResponseFromHubContainerDto (uk.gov.ida.integrationtest.hub.policy.builders.AuthnResponseFromHubContainerDtoBuilder.anAuthnResponseFromHubContainerDto)2 RequestForErrorResponseFromHubDto (uk.gov.ida.hub.policy.contracts.RequestForErrorResponseFromHubDto)1