Search in sources :

Example 1 with UserAccountCreationAttribute

use of uk.gov.ida.saml.hub.domain.UserAccountCreationAttribute 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");
}
Also used : UserAccountCreationAttribute(uk.gov.ida.saml.hub.domain.UserAccountCreationAttribute) UserAccountCreationAttribute(uk.gov.ida.saml.hub.domain.UserAccountCreationAttribute) Attribute(org.opensaml.saml.saml2.core.Attribute) Test(org.junit.jupiter.api.Test)

Example 2 with UserAccountCreationAttribute

use of uk.gov.ida.saml.hub.domain.UserAccountCreationAttribute 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");
}
Also used : UserAccountCreationAttribute(uk.gov.ida.saml.hub.domain.UserAccountCreationAttribute) UserAccountCreationAttribute(uk.gov.ida.saml.hub.domain.UserAccountCreationAttribute) Attribute(org.opensaml.saml.saml2.core.Attribute) Test(org.junit.jupiter.api.Test)

Example 3 with UserAccountCreationAttribute

use of uk.gov.ida.saml.hub.domain.UserAccountCreationAttribute 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();
}
Also used : UserAccountCreationAttribute(uk.gov.ida.saml.hub.domain.UserAccountCreationAttribute) UserAccountCreationAttribute(uk.gov.ida.saml.hub.domain.UserAccountCreationAttribute) Attribute(org.opensaml.saml.saml2.core.Attribute) Test(org.junit.jupiter.api.Test)

Example 4 with UserAccountCreationAttribute

use of uk.gov.ida.saml.hub.domain.UserAccountCreationAttribute in project verify-hub by alphagov.

the class AttributeQueryAttributeFactory method createAttribute.

public Attribute createAttribute(final UserAccountCreationAttribute userAccountCreationAttribute) {
    final Attribute attribute = openSamlXmlObjectFactory.createAttribute();
    attribute.setName(userAccountCreationAttribute.getAttributeName());
    attribute.setNameFormat(Attribute.UNSPECIFIED);
    return attribute;
}
Also used : UserAccountCreationAttribute(uk.gov.ida.saml.hub.domain.UserAccountCreationAttribute) Attribute(org.opensaml.saml.saml2.core.Attribute)

Aggregations

Attribute (org.opensaml.saml.saml2.core.Attribute)4 UserAccountCreationAttribute (uk.gov.ida.saml.hub.domain.UserAccountCreationAttribute)4 Test (org.junit.jupiter.api.Test)3