Class UserAttribute

java.lang.Object
se.swedenconnect.spring.saml.idp.attributes.UserAttribute
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
RequestedAttribute

public class UserAttribute extends Object implements Serializable
A representation of a user (identity) attribute.
Author:
Martin Lindström
See Also:
  • Field Details

    • DEFAULT_NAME_FORMAT

      public static final String DEFAULT_NAME_FORMAT
      The default name format for SAML attributes.
      See Also:
  • Constructor Details

    • UserAttribute

      public UserAttribute(String id)
      Constructor.
      Parameters:
      id - the attribute ID (name)
    • UserAttribute

      public UserAttribute(String id, String friendlyName)
      Constructor.
      Parameters:
      id - the attribute ID (name)
      friendlyName - the attribute friendly name
    • UserAttribute

      public UserAttribute(String id, String friendlyName, Serializable value)
      Constructor.
      Parameters:
      id - the attribute ID (name)
      friendlyName - the attribute friendly name
      value - the attribute value
    • UserAttribute

      public UserAttribute(String id, String friendlyName, List<? extends Serializable> values)
      Constructor.
      Parameters:
      id - the attribute ID (name)
      friendlyName - the attribute friendly name
      values - the attribute values
    • UserAttribute

      public UserAttribute(org.opensaml.saml.saml2.core.Attribute attribute)
      Constructs an UserAttribute given an OpenSAML Attribute.
      Parameters:
      attribute - an OpenSAML Attribute
  • Method Details

    • getId

      public String getId()
      Gets the attribute ID (name).
      Returns:
      the attribute ID (name)
    • getFriendlyName

      public String getFriendlyName()
      Gets the attribute friendly name.
      Returns:
      the attribute friendly name (or null if none has been assigned)
    • setFriendlyName

      public void setFriendlyName(String friendlyName)
      Assigns the friendly name.
      Parameters:
      friendlyName - the friendly name
    • getNameFormat

      public String getNameFormat()
      Gets the name format URI for the attribute.
      Returns:
      the name format
    • setNameFormat

      public void setNameFormat(String nameFormat)
      Assigns the attribute name format.
      Parameters:
      nameFormat - the name format
    • getValues

      public List<? extends Serializable> getValues()
      Gets the attribute value(s).
      Returns:
      the attribute value(s)
    • getStringValues

      public List<String> getStringValues()
      Gets the attribute value(s) in string format.
      Returns:
      the attribute value(s) in string format
    • setValue

      public void setValue(Serializable value)
      Assigns the attribute value.
      Parameters:
      value - the value
      See Also:
    • setValues

      public void setValues(List<? extends Serializable> values)
      Assigns the attribute values.
      Parameters:
      values - the values
      See Also:
    • toOpenSamlAttribute

      public org.opensaml.saml.saml2.core.Attribute toOpenSamlAttribute()
      Converts this object into an OpenSAML Attribute object.
      Returns:
      an OpenSAML Attribute
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • valuesToString

      public String valuesToString()