Search in sources :

Example 6 with SamlRequestDto

use of uk.gov.ida.hub.samlengine.domain.SamlRequestDto in project verify-hub by alphagov.

the class CountryAuthnRequestGeneratorResourceTest method shouldRespondWithSamlRequest.

@Test
public void shouldRespondWithSamlRequest() throws Exception {
    final URI ssoUri = URI.create("http://foo.com/bar");
    Response clientResponse = generateCountryAuthnRequest();
    assertThat(clientResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
    SamlRequestDto samlRequestDto = clientResponse.readEntity(SamlRequestDto.class);
    assertThat(samlRequestDto.getSamlRequest()).isNotNull();
    assertThat(samlRequestDto.getSsoUri()).isEqualTo(ssoUri);
}
Also used : Response(javax.ws.rs.core.Response) SamlRequestDto(uk.gov.ida.hub.samlengine.domain.SamlRequestDto) URI(java.net.URI) Test(org.junit.Test)

Example 7 with SamlRequestDto

use of uk.gov.ida.hub.samlengine.domain.SamlRequestDto in project verify-hub by alphagov.

the class IdpAuthnRequestGeneratorResourceTest method sendAuthnRequest_shouldRespondWithSamlRequest.

@Test
public void sendAuthnRequest_shouldRespondWithSamlRequest() throws Exception {
    final String idpEntityId = STUB_IDP_ONE;
    final URI ssoUri = URI.create("http://foo.com/bar");
    IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto = new IdaAuthnRequestFromHubDto("1", asList(AuthnContext.LEVEL_2), Optional.of(false), new DateTime(), idpEntityId, false);
    final URI uri = samlEngineAppRule.getUri(Urls.SamlEngineUrls.GENERATE_IDP_AUTHN_REQUEST_RESOURCE);
    Response clientResponse = client.target(uri).request(MediaType.APPLICATION_JSON_TYPE).post(Entity.entity(idaAuthnRequestFromHubDto, MediaType.APPLICATION_JSON_TYPE));
    assertThat(clientResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
    SamlRequestDto samlRequestDto = clientResponse.readEntity(SamlRequestDto.class);
    assertThat(samlRequestDto.getSamlRequest()).isNotNull();
    assertThat(samlRequestDto.getSsoUri()).isEqualTo(ssoUri);
}
Also used : Response(javax.ws.rs.core.Response) IdaAuthnRequestFromHubDto(uk.gov.ida.hub.samlengine.contracts.IdaAuthnRequestFromHubDto) SamlRequestDto(uk.gov.ida.hub.samlengine.domain.SamlRequestDto) URI(java.net.URI) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Aggregations

URI (java.net.URI)7 SamlRequestDto (uk.gov.ida.hub.samlengine.domain.SamlRequestDto)7 Test (org.junit.Test)5 IdaAuthnRequestFromHubDto (uk.gov.ida.hub.samlengine.contracts.IdaAuthnRequestFromHubDto)4 Response (javax.ws.rs.core.Response)2 EidasAuthnRequestFromHub (uk.gov.ida.saml.hub.domain.EidasAuthnRequestFromHub)2 DateTime (org.joda.time.DateTime)1 IdaAuthnRequestFromHub (uk.gov.ida.saml.hub.domain.IdaAuthnRequestFromHub)1