use of uk.gov.ida.saml.core.domain.AuthnContext in project verify-hub by alphagov.
the class MatchingServiceResponseTranslatorServiceTest method populateReturnDtoCorrectly_handleNoMatchResponse.
@Test
public void populateReturnDtoCorrectly_handleNoMatchResponse() {
final String inResponseTo = "inResponseTo";
final String issuer = "issuer";
final Optional<AuthnContext> authnContext = Optional.of(AuthnContext.LEVEL_2);
final Optional<FraudDetectedDetails> fraudDetectedDetails = Optional.empty();
final String underlyingAssertionBlob = "underlyingAssertionBlob";
final MatchingServiceIdaStatus status = MatchingServiceIdaStatus.NoMatchingServiceMatchFromMatchingService;
final SamlResponseDto samlResponse = new SamlResponseDto("saml");
setUpForTranslate(authnContext, fraudDetectedDetails, underlyingAssertionBlob, inResponseTo, issuer, samlResponse.getSamlResponse(), status);
final InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = matchingServiceResponseTranslatorService.translate(samlResponse);
assertThat(inboundResponseFromMatchingServiceDto.getInResponseTo()).isEqualTo(inResponseTo);
assertThat(inboundResponseFromMatchingServiceDto.getUnderlyingMatchingServiceAssertionBlob().isPresent()).isTrue();
assertThat(inboundResponseFromMatchingServiceDto.getUnderlyingMatchingServiceAssertionBlob().get()).isEqualTo(underlyingAssertionBlob);
assertThat(inboundResponseFromMatchingServiceDto.getIssuer()).isEqualTo(issuer);
assertThat(inboundResponseFromMatchingServiceDto.getLevelOfAssurance().isPresent()).isTrue();
assertThat(inboundResponseFromMatchingServiceDto.getLevelOfAssurance().get().name()).isEqualTo(authnContext.get().name());
assertThat(inboundResponseFromMatchingServiceDto.getStatus()).isEqualTo(status);
}
use of uk.gov.ida.saml.core.domain.AuthnContext in project verify-hub by alphagov.
the class MatchingServiceResponseTranslatorServiceTest method populateReturnDtoCorrectly_handleUserAccountCreatedResponse.
@Test
public void populateReturnDtoCorrectly_handleUserAccountCreatedResponse() {
final String inResponseTo = "inResponseTo";
final String issuer = "issuer";
final Optional<AuthnContext> authnContext = Optional.of(AuthnContext.LEVEL_2);
final Optional<FraudDetectedDetails> fraudDetectedDetails = Optional.empty();
final String underlyingAssertionBlob = "underlyingAssertionBlob";
final MatchingServiceIdaStatus status = MatchingServiceIdaStatus.UserAccountCreated;
final SamlResponseDto samlResponse = new SamlResponseDto("saml");
setUpForTranslate(authnContext, fraudDetectedDetails, underlyingAssertionBlob, inResponseTo, issuer, samlResponse.getSamlResponse(), status);
final InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = matchingServiceResponseTranslatorService.translate(samlResponse);
assertThat(inboundResponseFromMatchingServiceDto.getInResponseTo()).isEqualTo(inResponseTo);
assertThat(inboundResponseFromMatchingServiceDto.getUnderlyingMatchingServiceAssertionBlob().isPresent()).isTrue();
assertThat(inboundResponseFromMatchingServiceDto.getUnderlyingMatchingServiceAssertionBlob().get()).isEqualTo(underlyingAssertionBlob);
assertThat(inboundResponseFromMatchingServiceDto.getIssuer()).isEqualTo(issuer);
assertThat(inboundResponseFromMatchingServiceDto.getLevelOfAssurance().isPresent()).isTrue();
assertThat(inboundResponseFromMatchingServiceDto.getLevelOfAssurance().get().name()).isEqualTo(authnContext.get().name());
assertThat(inboundResponseFromMatchingServiceDto.getStatus()).isEqualTo(status);
}
use of uk.gov.ida.saml.core.domain.AuthnContext in project verify-hub by alphagov.
the class IdaAuthnRequestTranslator method getIdaAuthnRequestFromHub.
public IdaAuthnRequestFromHub getIdaAuthnRequestFromHub(IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto, URI ssoUri, String hubEntityId) {
List<AuthnContext> levelsOfAssurance = idaAuthnRequestFromHubDto.getLevelsOfAssurance();
AuthnContextComparisonTypeEnumeration comparisonType;
if (idaAuthnRequestFromHubDto.getUseExactComparisonType()) {
comparisonType = EXACT;
} else {
comparisonType = MINIMUM;
if (levelsOfAssurance.size() == 1) {
levelsOfAssurance = Arrays.asList(levelsOfAssurance.get(0), levelsOfAssurance.get(0));
}
}
return createRequestToSendFromHub(idaAuthnRequestFromHubDto.getId(), levelsOfAssurance, idaAuthnRequestFromHubDto.getForceAuthentication(), idaAuthnRequestFromHubDto.getSessionExpiryTimestamp(), ssoUri, comparisonType, hubEntityId);
}
Aggregations