use of uk.gov.ida.saml.core.domain.FraudDetectedDetails 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 SamlResponseContainerDto samlResponse = new SamlResponseContainerDto("saml", TEST_RP);
setUpForTranslate(authnContext, fraudDetectedDetails, underlyingAssertionBlob, inResponseTo, issuer, samlResponse.getSamlResponse(), status);
final InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = matchingServiceResponseTranslatorService.translate(samlResponse);
assertThat(inboundResponseFromMatchingServiceDto.getInResponseTo()).isEqualTo(inResponseTo);
assertThat(inboundResponseFromMatchingServiceDto.getEncryptedMatchingServiceAssertion().isPresent()).isTrue();
assertThat(inboundResponseFromMatchingServiceDto.getEncryptedMatchingServiceAssertion().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.FraudDetectedDetails 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 SamlResponseContainerDto samlResponse = new SamlResponseContainerDto("saml", TEST_RP);
setUpForTranslate(authnContext, fraudDetectedDetails, underlyingAssertionBlob, inResponseTo, issuer, samlResponse.getSamlResponse(), status);
final InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = matchingServiceResponseTranslatorService.translate(samlResponse);
assertThat(inboundResponseFromMatchingServiceDto.getInResponseTo()).isEqualTo(inResponseTo);
assertThat(inboundResponseFromMatchingServiceDto.getEncryptedMatchingServiceAssertion().isPresent()).isTrue();
assertThat(inboundResponseFromMatchingServiceDto.getEncryptedMatchingServiceAssertion().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.FraudDetectedDetails in project verify-hub by alphagov.
the class PassthroughAssertionUnmarshallerTest method transform_shouldTransformTheIdpFraudEventIdForAFraudAssertion.
@Test
public void transform_shouldTransformTheIdpFraudEventIdForAFraudAssertion() {
String fraudEventId = "Fraud Id";
Assertion theAssertion = anAssertion().addAuthnStatement(anAuthnStatement().withAuthnContext(anAuthnContext().withAuthnContextClassRef(anAuthnContextClassRef().withAuthnContextClasRefValue(IdaAuthnContext.LEVEL_X_AUTHN_CTX).build()).build()).build()).addAttributeStatement(anAttributeStatement().addAttribute(anIdpFraudEventIdAttribute().withValue(fraudEventId).build()).addAttribute(aGpg45StatusAttribute().build()).build()).buildUnencrypted();
when(authnContextFactory.authnContextForLevelOfAssurance(IdaAuthnContext.LEVEL_X_AUTHN_CTX)).thenReturn(AuthnContext.LEVEL_X);
PassthroughAssertion passthroughAssertion = unmarshaller.fromAssertion(theAssertion);
FraudDetectedDetails fraudDetectedDetails = passthroughAssertion.getFraudDetectedDetails().get();
assertThat(fraudDetectedDetails.getIdpFraudEventId()).isEqualTo(fraudEventId);
}
use of uk.gov.ida.saml.core.domain.FraudDetectedDetails in project verify-hub by alphagov.
the class PassthroughAssertionUnmarshallerTest method transform_shouldTransformTheGpg45StatusFi01ForAFraudAssertion.
@Test
public void transform_shouldTransformTheGpg45StatusFi01ForAFraudAssertion() {
String gpg45Status = "FI01";
Assertion theAssertion = givenAFraudEventAssertion(gpg45Status);
PassthroughAssertion passthroughAssertion = unmarshaller.fromAssertion(theAssertion);
FraudDetectedDetails fraudDetectedDetails = passthroughAssertion.getFraudDetectedDetails().get();
assertThat(fraudDetectedDetails.getFraudIndicator()).isEqualTo(gpg45Status);
}
use of uk.gov.ida.saml.core.domain.FraudDetectedDetails in project verify-hub by alphagov.
the class PassthroughAssertionUnmarshallerTest method transform_shouldTransformTheGpg45StatusDF01ForAFraudAssertion.
@Test
public void transform_shouldTransformTheGpg45StatusDF01ForAFraudAssertion() {
String gpg45Status = "DF01";
Assertion theAssertion = givenAFraudEventAssertion(gpg45Status);
PassthroughAssertion passthroughAssertion = unmarshaller.fromAssertion(theAssertion);
FraudDetectedDetails fraudDetectedDetails = passthroughAssertion.getFraudDetectedDetails().get();
assertThat(fraudDetectedDetails.getFraudIndicator()).isEqualTo(gpg45Status);
}
Aggregations