use of org.opensaml.saml2.core.Assertion in project verify-hub by alphagov.
the class MatchingDatasetAssertionValidatorTest method validate_shouldNotThrowAnExceptionWhenMiddleNameIsPresent_ProfileV1_1.
@Test
public void validate_shouldNotThrowAnExceptionWhenMiddleNameIsPresent_ProfileV1_1() {
AttributeStatement attributeStatement = anEmptyMatchingDatasetAttributeStatement_1_1().withMiddleNames(aPersonName_1_1().buildAsMiddlename()).build();
Assertion matchingDatasetAssertion = anAssertion().addAttributeStatement(attributeStatement).buildUnencrypted();
validator.validate(matchingDatasetAssertion, RESPONSE_ISSUER_ID);
}
use of org.opensaml.saml2.core.Assertion in project verify-hub by alphagov.
the class MatchingDatasetAssertionValidatorTest method validate_shouldValidateForDuplicateIds.
@Test
public void validate_shouldValidateForDuplicateIds() {
AttributeStatement attributeStatement = anEmptyMatchingDatasetAttributeStatement_1_1().withFirstname(aPersonName_1_1().buildAsFirstname()).build();
Assertion matchingDatasetAssertion = anAssertion().addAttributeStatement(attributeStatement).buildUnencrypted();
validator.validate(matchingDatasetAssertion, RESPONSE_ISSUER_ID);
verify(duplicateAssertionValidator, times(1)).validateMatchingDataSetAssertion(matchingDatasetAssertion, RESPONSE_ISSUER_ID);
}
use of org.opensaml.saml2.core.Assertion in project verify-hub by alphagov.
the class MatchingDatasetAssertionValidatorTest method validate_shouldThrowExceptionWhenNameIsNotRecognised.
@Test
public void validate_shouldThrowExceptionWhenNameIsNotRecognised() {
Attribute attribute = aSimpleStringAttribute().withName("dummy attribute").build();
AttributeStatement attributeStatement = anEmptyMatchingDatasetAttributeStatement_1_1().addCustomAttribute(attribute).build();
Assertion assertion = anAssertion().addAttributeStatement(attributeStatement).buildUnencrypted();
validateFail(() -> validator.validate(assertion, RESPONSE_ISSUER_ID), mdsAttributeNotRecognised("dummy attribute"));
}
use of org.opensaml.saml2.core.Assertion in project verify-hub by alphagov.
the class MatchingDatasetAssertionValidatorTest method validate_shouldThrowExceptionWhenAttributeValueIsIncorrectType.
@Test
public void validate_shouldThrowExceptionWhenAttributeValueIsIncorrectType() {
Attribute attribute = aSimpleStringAttribute().withName(IdaConstants.Attributes_1_1.Firstname.NAME).withSimpleStringValue("Joe").build();
AttributeStatement attributeStatement = aMatchingDatasetAttributeStatement_1_1().withFirstname(attribute).build();
Assertion matchingDatasetAssertion = anAssertion().addAttributeStatement(attributeStatement).buildUnencrypted();
validateFail(() -> validator.validate(matchingDatasetAssertion, RESPONSE_ISSUER_ID), attributeWithIncorrectType(IdaConstants.Attributes_1_1.Firstname.NAME, PersonName.TYPE_NAME, StringBasedMdsAttributeValue.TYPE_NAME));
}
use of org.opensaml.saml2.core.Assertion in project verify-hub by alphagov.
the class MatchingDatasetAssertionValidatorTest method validate_shouldNotThrowExceptionWhenAttributeValueVerifiedIsAbsent.
@Test
public void validate_shouldNotThrowExceptionWhenAttributeValueVerifiedIsAbsent() {
Attribute attribute = aPersonName_1_1().addValue(aPersonNameValue().withVerified(null).build()).buildAsFirstname();
AttributeStatement attributeStatement = aMatchingDatasetAttributeStatement_1_1().withFirstname(attribute).build();
Assertion matchingDatasetAssertion = anAssertion().addAttributeStatement(attributeStatement).buildUnencrypted();
validator.validate(matchingDatasetAssertion, RESPONSE_ISSUER_ID);
}
Aggregations