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);
}
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);
}
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);
}
Aggregations