use of org.opensaml.saml.saml2.core.Attribute in project verify-hub by alphagov.
the class MatchingDatasetAssertionValidatorTest method validate_shouldNotThrowExceptionWhenAttributeValueFromDateIsAbsent.
@Test
public void validate_shouldNotThrowExceptionWhenAttributeValueFromDateIsAbsent() {
Attribute attribute = aPersonName_1_1().addValue(aPersonNameValue().withFrom(null).build()).buildAsFirstname();
AttributeStatement attributeStatement = aMatchingDatasetAttributeStatement_1_1().withFirstname(attribute).build();
Assertion matchingDatasetAssertion = anAssertion().addAttributeStatement(attributeStatement).buildUnencrypted();
validator.validate(matchingDatasetAssertion, RESPONSE_ISSUER_ID);
}
use of org.opensaml.saml.saml2.core.Attribute 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.Attribute 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.Attribute in project verify-hub by alphagov.
the class AttributeQueryAttributeFactoryTest method createAttribute_shouldNotSetFriendlyName.
@Test
public void createAttribute_shouldNotSetFriendlyName() {
UserAccountCreationAttribute userAccountCreationAttribute = UserAccountCreationAttribute.CURRENT_ADDRESS;
Attribute attribute = attributeQueryAttributeFactory.createAttribute(userAccountCreationAttribute);
assertThat(attribute.getFriendlyName()).isNull();
}
use of org.opensaml.saml.saml2.core.Attribute in project verify-hub by alphagov.
the class AuthnRequestFromRelyingPartyUnmarshallerTest method createApplicationVersionExtensions.
private Extensions createApplicationVersionExtensions(String version) throws Exception {
Extensions extensions = new ExtensionsBuilder().buildObject();
Attribute versionsAttribute = new AttributeBuilder().buildObject();
versionsAttribute.setName("Versions");
versionsAttribute.getAttributeValues().add(createApplicationVersion(version));
extensions.getUnknownXMLObjects().add(encrypter.encrypt(versionsAttribute));
return extensions;
}
Aggregations