use of org.opensaml.saml.saml2.core.AttributeStatement in project verify-hub by alphagov.
the class MatchingDatasetAssertionValidatorTest method validate_shouldNotThrowAnExceptionWhenGenderIsPresent_ProfileV1_1.
@Test
public void validate_shouldNotThrowAnExceptionWhenGenderIsPresent_ProfileV1_1() {
AttributeStatement attributeStatement = anEmptyMatchingDatasetAttributeStatement_1_1().withGender().build();
Assertion matchingDatasetAssertion = anAssertion().addAttributeStatement(attributeStatement).buildUnencrypted();
validator.validate(matchingDatasetAssertion, RESPONSE_ISSUER_ID);
}
use of org.opensaml.saml.saml2.core.AttributeStatement in project verify-hub by alphagov.
the class MatchingDatasetAssertionValidatorTest method validate_shouldThrowExceptionWhenAttributeValueTypeIsValidButIncorrectForAttribute.
@Test
public void validate_shouldThrowExceptionWhenAttributeValueTypeIsValidButIncorrectForAttribute() {
Attribute attribute = aPersonName_1_1().addValue(aPersonNameValue().withFrom(null).build()).buildAsFirstname();
attribute.setName(IdaConstants.Attributes_1_1.DateOfBirth.NAME);
AttributeStatement attributeStatement = aMatchingDatasetAttributeStatement_1_1().withDateOfBirth(attribute).build();
Assertion matchingDatasetAssertion = anAssertion().addAttributeStatement(attributeStatement).buildUnencrypted();
validateFail(() -> validator.validate(matchingDatasetAssertion, RESPONSE_ISSUER_ID), attributeWithIncorrectType(IdaConstants.Attributes_1_1.DateOfBirth.NAME, Date.TYPE_NAME, PersonName.TYPE_NAME));
}
use of org.opensaml.saml.saml2.core.AttributeStatement in project verify-hub by alphagov.
the class MatchingDatasetAssertionValidatorTest method validate_shouldThrowExceptionWhenAttributeIsMissingValue.
@Test
public void validate_shouldThrowExceptionWhenAttributeIsMissingValue() {
Attribute attribute = aPersonName_1_1().buildAsFirstnameWithNoAttributeValues();
AttributeStatement attributeStatement = aMatchingDatasetAttributeStatement_1_1().withFirstname(attribute).build();
Assertion matchingDatasetAssertion = anAssertion().addAttributeStatement(attributeStatement).buildUnencrypted();
validateFail(() -> validator.validate(matchingDatasetAssertion, RESPONSE_ISSUER_ID), emptyAttribute("MDS_firstname"));
}
use of org.opensaml.saml.saml2.core.AttributeStatement in project verify-hub by alphagov.
the class MatchingDatasetAssertionValidatorTest method validate_shouldNotThrowAnExceptionWhenSurNameIsPresent_ProfileV1_1.
@Test
public void validate_shouldNotThrowAnExceptionWhenSurNameIsPresent_ProfileV1_1() {
AttributeStatement attributeStatement = anEmptyMatchingDatasetAttributeStatement_1_1().withSurname(aPersonName_1_1().buildAsSurname()).build();
Assertion matchingDatasetAssertion = anAssertion().addAttributeStatement(attributeStatement).buildUnencrypted();
validator.validate(matchingDatasetAssertion, RESPONSE_ISSUER_ID);
}
use of org.opensaml.saml.saml2.core.AttributeStatement in project verify-hub by alphagov.
the class MatchingDatasetAssertionValidatorTest method validate_shouldThrowExceptionWhenNoAttributesArePresent.
@Test
public void validate_shouldThrowExceptionWhenNoAttributesArePresent() {
AttributeStatement attributeStatement = anEmptyMatchingDatasetAttributeStatement_1_1().build();
Assertion matchingDatasetAssertion = anAssertion().addAttributeStatement(attributeStatement).buildUnencrypted();
validateFail(() -> validator.validate(matchingDatasetAssertion, RESPONSE_ISSUER_ID), attributeStatementEmpty(matchingDatasetAssertion.getID()));
}
Aggregations