Search in sources :

Example 6 with IdaAuthnRequestFromHubDto

use of uk.gov.ida.hub.samlengine.contracts.IdaAuthnRequestFromHubDto in project verify-hub by alphagov.

the class IdaAuthnRequestTranslatorTest method shouldUseExactComparisonTypeAndLevelsOfAssurance.

@Test
public void shouldUseExactComparisonTypeAndLevelsOfAssurance() {
    IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto = aRequestDto(asList(AuthnContext.LEVEL_2), true);
    IdaAuthnRequestFromHub idaAuthnRequestFromHub = idaAuthnRequestTranslator.getIdaAuthnRequestFromHub(idaAuthnRequestFromHubDto, URI.create("http://example.com"), HUB_ENTITY_ID);
    assertThat(idaAuthnRequestFromHub.getComparisonType()).isEqualTo(AuthnContextComparisonTypeEnumeration.EXACT);
    assertThat(idaAuthnRequestFromHub.getLevelsOfAssurance()).containsSequence(AuthnContext.LEVEL_2);
}
Also used : IdaAuthnRequestFromHub(uk.gov.ida.saml.hub.domain.IdaAuthnRequestFromHub) IdaAuthnRequestFromHubDto(uk.gov.ida.hub.samlengine.contracts.IdaAuthnRequestFromHubDto) Test(org.junit.Test)

Example 7 with IdaAuthnRequestFromHubDto

use of uk.gov.ida.hub.samlengine.contracts.IdaAuthnRequestFromHubDto in project verify-hub by alphagov.

the class IdaAuthnRequestTranslatorTest method shouldUseMinimumComparisonTypeAndSendDuplicateLOAs.

@Test
public void shouldUseMinimumComparisonTypeAndSendDuplicateLOAs() {
    IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto = aRequestDto(asList(AuthnContext.LEVEL_2), false);
    IdaAuthnRequestFromHub idaAuthnRequestFromHub = idaAuthnRequestTranslator.getIdaAuthnRequestFromHub(idaAuthnRequestFromHubDto, URI.create("http://example.com"), HUB_ENTITY_ID);
    assertThat(idaAuthnRequestFromHub.getComparisonType()).isEqualTo(AuthnContextComparisonTypeEnumeration.MINIMUM);
    assertThat(idaAuthnRequestFromHub.getLevelsOfAssurance()).containsSequence(AuthnContext.LEVEL_2, AuthnContext.LEVEL_2);
}
Also used : IdaAuthnRequestFromHub(uk.gov.ida.saml.hub.domain.IdaAuthnRequestFromHub) IdaAuthnRequestFromHubDto(uk.gov.ida.hub.samlengine.contracts.IdaAuthnRequestFromHubDto) Test(org.junit.Test)

Example 8 with IdaAuthnRequestFromHubDto

use of uk.gov.ida.hub.samlengine.contracts.IdaAuthnRequestFromHubDto 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

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