use of org.opensaml.saml.saml2.core.Attribute 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.saml.saml2.core.Attribute 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);
}
use of org.opensaml.saml.saml2.core.Attribute in project verify-hub by alphagov.
the class MatchingDatasetAssertionValidatorTest method validate_shouldNotThrowExceptionWhenAttributeValueToDateIsAbsent.
@Test
public void validate_shouldNotThrowExceptionWhenAttributeValueToDateIsAbsent() {
Attribute attribute = aPersonName_1_1().addValue(aPersonNameValue().withTo(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 AttributeQueryAttributeFactoryTest method createAttribute_shouldPopulateAttributeNameFromUserAccountCreationAttributeValue.
@Test
public void createAttribute_shouldPopulateAttributeNameFromUserAccountCreationAttributeValue() {
UserAccountCreationAttribute userAccountCreationAttribute = UserAccountCreationAttribute.CURRENT_ADDRESS;
Attribute attribute = attributeQueryAttributeFactory.createAttribute(userAccountCreationAttribute);
assertThat(attribute.getName()).isEqualTo("currentaddress");
}
use of org.opensaml.saml.saml2.core.Attribute in project verify-hub by alphagov.
the class AttributeQueryAttributeFactoryTest method createAttribute_shouldPopulateAttributeNameFormatWithUnspecifiedFormat.
@Test
public void createAttribute_shouldPopulateAttributeNameFormatWithUnspecifiedFormat() {
UserAccountCreationAttribute userAccountCreationAttribute = UserAccountCreationAttribute.CURRENT_ADDRESS;
Attribute attribute = attributeQueryAttributeFactory.createAttribute(userAccountCreationAttribute);
assertThat(attribute.getNameFormat()).isEqualTo("urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified");
}
Aggregations