Class AttributeImpl
- java.lang.Object
-
- com.sun.identity.saml2.assertion.impl.AttributeImpl
-
- All Implemented Interfaces:
Attribute
public class AttributeImpl extends Object implements Attribute
This is a default implementation of interfaceAttribute. TheAttributeelement identifies an attribute by name and optionally includes its value(s). It has theAttributeTypecomplex type.<complexType name="AttributeType"> <complexContent> <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> <sequence> <element ref="{urn:oasis:names:tc:SAML:2.0:assertion} AttributeValue" maxOccurs="unbounded" minOccurs="0"/> </sequence> <attribute name="FriendlyName" type="{http://www.w3.org/2001/XMLSchema}string" /> <attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> <attribute name="NameFormat" type="{http://www.w3.org/2001/XMLSchema}anyURI" /> </restriction> </complexContent> </complexType>
-
-
Constructor Summary
Constructors Constructor Description AttributeImpl()Class constructor.AttributeImpl(String xmlString)Class constructor withAttributein xml string format.AttributeImpl(Element element)Class constructor withAttributeinElementformat.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EncryptedAttributeencrypt(Key recipientPublicKey, String dataEncAlgorithm, int dataEncStrength, String recipientEntityID)Returns anEncryptedAttributeobject.MapgetAnyAttribute()Returns theanyAttributeof the attribute.ListgetAttributeValue()Returns theAttributeValue(s) of theAttribute.ListgetAttributeValueString()Returns theAttributeValue(s) of theAttribute.StringgetFriendlyName()Returns theFriendlyNameof the attribute.StringgetName()Returns theNameof the attribute.StringgetNameFormat()Returns theNameFormatof the attribute.booleanisMutable()Returns the mutability of the object.voidmakeImmutable()Makes the object immutable.voidsetAnyAttribute(Map value)Sets theanyAttributeof the attribute.voidsetAttributeValue(List value)Sets theAttributeValue(s) of theAttribute.voidsetAttributeValueString(List value)Sets the value ofAttributeValueelement(s).voidsetFriendlyName(String value)Sets theFriendlyNameof the attribute.voidsetName(String value)Sets theNameof the attribute.voidsetNameFormat(String value)Sets theNameFormatof the attribute.StringtoXMLString()Returns a String representation of the element.StringtoXMLString(boolean includeNS, boolean declareNS)Returns a String representation of the element.
-
-
-
Constructor Detail
-
AttributeImpl
public AttributeImpl()
Class constructor. Caller may need to call setters to populate the object.
-
AttributeImpl
public AttributeImpl(Element element) throws SAML2Exception
Class constructor withAttributeinElementformat.- Throws:
SAML2Exception
-
AttributeImpl
public AttributeImpl(String xmlString) throws SAML2Exception
Class constructor withAttributein xml string format.- Throws:
SAML2Exception
-
-
Method Detail
-
makeImmutable
public void makeImmutable()
Makes the object immutable.- Specified by:
makeImmutablein interfaceAttribute
-
isMutable
public boolean isMutable()
Returns the mutability of the object.
-
getAttributeValue
public List getAttributeValue()
Returns theAttributeValue(s) of theAttribute.- Specified by:
getAttributeValuein interfaceAttribute- Returns:
- List of xml String representing
AttributeValue(s) of theAttribute. - See Also:
setAttributeValue(List)
-
setAttributeValue
public void setAttributeValue(List value) throws SAML2Exception
Sets theAttributeValue(s) of theAttribute.- Specified by:
setAttributeValuein interfaceAttribute- Parameters:
value- List of xml String representing the newAttributeValueelement(s).- Throws:
SAML2Exception- if the object is immutable or the input can not be converted toAttributeValueelement.- See Also:
getAttributeValue()
-
getAttributeValueString
public List getAttributeValueString()
Returns theAttributeValue(s) of theAttribute.- Specified by:
getAttributeValueStringin interfaceAttribute- Returns:
- List of String representing the value of
AttributeValue(s). - See Also:
setAttributeValueString(List)
-
setAttributeValueString
public void setAttributeValueString(List value) throws SAML2Exception
Sets the value ofAttributeValueelement(s).- Specified by:
setAttributeValueStringin interfaceAttribute- Parameters:
value- List of String representing the value of the newAttributeValueelement(s).- Throws:
SAML2Exception- if the object is immutable.- See Also:
getAttributeValueString()
-
getName
public String getName()
Returns theNameof the attribute.- Specified by:
getNamein interfaceAttribute- Returns:
- the
Nameof the attribute. - See Also:
setName(String)
-
setName
public void setName(String value) throws SAML2Exception
Sets theNameof the attribute.- Specified by:
setNamein interfaceAttribute- Parameters:
value- newNameof the attribute.- Throws:
SAML2Exception- if the object is immutable.- See Also:
getName()
-
getNameFormat
public String getNameFormat()
Returns theNameFormatof the attribute.- Specified by:
getNameFormatin interfaceAttribute- Returns:
- the value of
NameFormat. - See Also:
setNameFormat(String)
-
setNameFormat
public void setNameFormat(String value) throws SAML2Exception
Sets theNameFormatof the attribute.- Specified by:
setNameFormatin interfaceAttribute- Parameters:
value- newNameFormatof the attribute.- Throws:
SAML2Exception- if the object is immutable.- See Also:
getNameFormat()
-
getFriendlyName
public String getFriendlyName()
Returns theFriendlyNameof the attribute.- Specified by:
getFriendlyNamein interfaceAttribute- Returns:
- the value of
FriendlyNameof the attribute. - See Also:
setFriendlyName(String)
-
setFriendlyName
public void setFriendlyName(String value) throws SAML2Exception
Sets theFriendlyNameof the attribute.- Specified by:
setFriendlyNamein interfaceAttribute- Parameters:
value- newFriendlyNameof the attribute.- Throws:
SAML2Exception- if the object is immutable.- See Also:
getFriendlyName()
-
getAnyAttribute
public Map getAnyAttribute()
Returns theanyAttributeof the attribute.- Specified by:
getAnyAttributein interfaceAttribute- Returns:
- A Map containing name/value pairs of
anyAttribute. Both the name and value are String object types. - See Also:
setAnyAttribute(Map)
-
setAnyAttribute
public void setAnyAttribute(Map value) throws SAML2Exception
Sets theanyAttributeof the attribute.- Specified by:
setAnyAttributein interfaceAttribute- Parameters:
value- Map of name/value pairs to be set. Both the name and value are String object types.- Throws:
SAML2Exception- if the object is immutable.- See Also:
getAnyAttribute()
-
encrypt
public EncryptedAttribute encrypt(Key recipientPublicKey, String dataEncAlgorithm, int dataEncStrength, String recipientEntityID) throws SAML2Exception
Returns anEncryptedAttributeobject.- Specified by:
encryptin interfaceAttribute- Parameters:
recipientPublicKey- Public key used to encrypt the data encryption (secret) key, it is the public key of the recipient of the XML document to be encrypted.dataEncAlgorithm- Data encryption algorithm.dataEncStrength- Data encryption strength.recipientEntityID- Unique identifier of the recipient, it is used as the index to the cached secret key so that the key can be reused for the same recipient; It can be null in which case the secret key will be generated every time and will not be cached and reused. Note that the generation of a secret key is a relatively expensive operation.- Returns:
EncryptedAttributeobject- Throws:
SAML2Exception- if error occurs during the encryption process.
-
toXMLString
public String toXMLString() throws SAML2Exception
Returns a String representation of the element.- Specified by:
toXMLStringin interfaceAttribute- Returns:
- A string containing the valid XML for this element. By default name space name is prepended to the element name.
- Throws:
SAML2Exception- if the object does not conform to the schema.
-
toXMLString
public String toXMLString(boolean includeNS, boolean declareNS) throws SAML2Exception
Returns a String representation of the element.- Specified by:
toXMLStringin interfaceAttribute- Parameters:
includeNS- Determines whether or not the namespace qualifier is prepended to the Element when converteddeclareNS- Determines whether or not the namespace is declared within the Element.- Returns:
- A string containing the valid XML for this element
- Throws:
SAML2Exception- if the object does not conform to the schema.
-
-