Search in sources :

Example 1 with IdaAuthnRequestFromHub

use of uk.gov.ida.saml.hub.domain.IdaAuthnRequestFromHub in project verify-hub by alphagov.

the class IdaAuthnRequestTranslatorTest method shouldUseMinimumComparisonTypeAndDuplicateSingleLevelOfAssurance.

@Test
public void shouldUseMinimumComparisonTypeAndDuplicateSingleLevelOfAssurance() {
    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 2 with IdaAuthnRequestFromHub

use of uk.gov.ida.saml.hub.domain.IdaAuthnRequestFromHub in project verify-hub by alphagov.

the class IdpAuthnRequestGeneratorService method generateSaml.

public SamlRequestDto generateSaml(IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto) {
    URI ssoUri = idpSingleSignOnServiceHelper.getSingleSignOn(idaAuthnRequestFromHubDto.getIdpEntityId());
    IdaAuthnRequestFromHub idaAuthnRequestFromHub = idaAuthnRequestTranslator.getIdaAuthnRequestFromHub(idaAuthnRequestFromHubDto, ssoUri, hubEntityId);
    String request = idaRequestStringTransformer.apply(idaAuthnRequestFromHub);
    return new SamlRequestDto(request, ssoUri);
}
Also used : IdaAuthnRequestFromHub(uk.gov.ida.saml.hub.domain.IdaAuthnRequestFromHub) SamlRequestDto(uk.gov.ida.hub.samlengine.domain.SamlRequestDto) URI(java.net.URI)

Example 3 with IdaAuthnRequestFromHub

use of uk.gov.ida.saml.hub.domain.IdaAuthnRequestFromHub in project verify-hub by alphagov.

the class IdaAuthnRequestTranslatorTest method shouldUseMinimumComparisonTypeAndLevelsOfAssuranceAsIs.

@Test
public void shouldUseMinimumComparisonTypeAndLevelsOfAssuranceAsIs() {
    IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto = aRequestDto(asList(AuthnContext.LEVEL_1, 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_1, 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 4 with IdaAuthnRequestFromHub

use of uk.gov.ida.saml.hub.domain.IdaAuthnRequestFromHub 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 5 with IdaAuthnRequestFromHub

use of uk.gov.ida.saml.hub.domain.IdaAuthnRequestFromHub 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)

Aggregations

IdaAuthnRequestFromHub (uk.gov.ida.saml.hub.domain.IdaAuthnRequestFromHub)6 Test (org.junit.Test)5 IdaAuthnRequestFromHubDto (uk.gov.ida.hub.samlengine.contracts.IdaAuthnRequestFromHubDto)4 URI (java.net.URI)2 Response (javax.ws.rs.core.Response)1 SessionId (uk.gov.ida.common.SessionId)1 SamlRequestDto (uk.gov.ida.hub.samlengine.domain.SamlRequestDto)1 AuthnRequestFromHubContainerDto (uk.gov.ida.hub.samlproxy.domain.AuthnRequestFromHubContainerDto)1 ResponseForHubBuilder.anAuthnResponse (uk.gov.ida.saml.core.test.builders.ResponseForHubBuilder.anAuthnResponse)1 HubTransformersFactory (uk.gov.ida.saml.hub.api.HubTransformersFactory)1