use of org.opensaml.saml2.core.Response in project verify-hub by alphagov.
the class EncryptedResponseFromMatchingServiceValidatorTest method validate_shouldDoNothingIfASuccessStatusContainsASubStatusOfMatch.
@Test
public void validate_shouldDoNothingIfASuccessStatusContainsASubStatusOfMatch() throws Exception {
Response response = aResponse().withStatus(happyStatus).build();
validator.validate(response);
}
use of org.opensaml.saml2.core.Response in project verify-hub by alphagov.
the class EncryptedResponseFromMatchingServiceValidatorTest method validateRequest_shouldThrowExceptionIfResponseIsNotSigned.
@Test
public void validateRequest_shouldThrowExceptionIfResponseIsNotSigned() throws Exception {
Response response = aResponse().withoutSigning().build();
assertValidationFailure(response, signatureNotSigned());
}
use of org.opensaml.saml2.core.Response in project verify-hub by alphagov.
the class EncryptedResponseFromMatchingServiceValidatorTest method validate_shouldThrowInvalidSamlExceptionIfIssuerElementIsMissing.
@Test
public void validate_shouldThrowInvalidSamlExceptionIfIssuerElementIsMissing() throws Exception {
Response response = aResponse().withIssuer(null).build();
assertValidationFailure(response, missingIssuer());
}
use of org.opensaml.saml2.core.Response in project verify-hub by alphagov.
the class ResponseAssertionsFromIdpValidatorTest method validate_shouldDelegateToIpAddressValidator.
@Test
public void validate_shouldDelegateToIpAddressValidator() throws Exception {
Assertion authnStatementAssertion = anAssertion().addAuthnStatement(anAuthnStatement().build()).buildUnencrypted();
Response response = aResponse().addEncryptedAssertion(anAssertion().addAttributeStatement(aMatchingDatasetAttributeStatement_1_1().build()).build()).addEncryptedAssertion(anAssertion().addAuthnStatement(anAuthnStatement().build()).build()).build();
List<Assertion> assertions = asList(anAssertion().addAttributeStatement(aMatchingDatasetAttributeStatement_1_1().build()).buildUnencrypted(), authnStatementAssertion);
validator.validate(new ValidatedResponse(response), new ValidatedAssertions(assertions));
verify(ipAddressValidator).validate(authnStatementAssertion);
}
use of org.opensaml.saml2.core.Response in project verify-hub by alphagov.
the class ResponseAssertionsFromIdpValidatorTest method validate_shouldThrowExceptionIfAuthnStatementAssertionIsMissing.
@Test
public void validate_shouldThrowExceptionIfAuthnStatementAssertionIsMissing() throws Exception {
Response response = aResponse().addEncryptedAssertion(anAssertion().addAttributeStatement(aMatchingDatasetAttributeStatement_1_1().build()).build()).addEncryptedAssertion(anAssertion().addAttributeStatement(aMatchingDatasetAttributeStatement_1_1().build()).build()).build();
List<Assertion> assertions = asList(anAssertion().addAttributeStatement(aMatchingDatasetAttributeStatement_1_1().build()).buildUnencrypted(), anAssertion().addAttributeStatement(aMatchingDatasetAttributeStatement_1_1().build()).buildUnencrypted());
validateException(assertThrows(SamlTransformationErrorException.class, () -> validator.validate(new ValidatedResponse(response), new ValidatedAssertions(assertions))), SamlTransformationErrorFactory.missingAuthnStatement());
}
Aggregations