IBM WebSphere Application ServerTM
Release 7

com.ibm.wsspi.wssecurity.saml.data
Class SAMLAttribute

java.lang.Object
  extended by com.ibm.wsspi.wssecurity.saml.data.SAMLAttribute
All Implemented Interfaces:
java.io.Serializable

public class SAMLAttribute
extends java.lang.Object
implements java.io.Serializable

This is class represents a SAML user attribute that can be contained in a SAML Assertion.

See Also:
Serialized Form

Field Summary
static java.lang.String XSITYPE_NONE
           
static java.lang.String XSITYPE_XSD_BASE64BINARY
           
static java.lang.String XSITYPE_XSD_STRING
           
 
Constructor Summary
SAMLAttribute(SAMLAttribute anAttribute)
          Constructs a new SAMLAttribute that is a copy of the argument SAMLAttribute.
SAMLAttribute(java.lang.String name, java.lang.String[] stringAttributeValue, OMStructure[] omAttributeValue, java.lang.String attributeNamespace, java.lang.String nameFormat, java.lang.String friendlyName)
          Constructs a new SAMLAttribute supporting OMStructure.
SAMLAttribute(java.lang.String name, java.lang.String[] stringAttributeValue, OMStructure[] omAttributeValue, java.lang.String attributeNamespace, java.lang.String nameFormat, java.lang.String friendlyName, java.lang.String encoding, java.lang.String xsiType)
          Constructs a new SAMLAttribute supporting OMStructure and the additional parameters required for X:500 LDAP.
SAMLAttribute(java.lang.String name, java.lang.String[] stringAttributeValue, com.ibm.websphere.wssecurity.wssapi.XMLStructure[] xmlAttributeValue, java.lang.String attributeNamespace, java.lang.String nameFormat, java.lang.String friendlyName)
          Constructs a new SAMLAttribute supporting XMLStructure.
 
Method Summary
static SAMLAttribute buildSAML11Attribute(java.lang.String name, java.lang.String[] stringAttributeValue, OMStructure[] omAttributeValue, java.lang.String attributeNamespace)
          Create a SAMLAttribute that is valid for the SAML 1.1 schema.
static SAMLAttribute buildSAML20Attribute(java.lang.String name, java.lang.String[] stringAttributeValue, OMStructure[] omAttributeValue, java.lang.String nameFormat, java.lang.String friendlyName)
          Create a SAMLAttribute that is valid for the SAML 2.0 schema.
static SAMLAttribute buildSAML20LDAPBase64TypeAttribute(java.lang.String name, java.lang.String[] stringAttributeValue, java.lang.String friendlyName)
          Create a SAMLAttribute that is valid for the SAML 2.0 X.500 LDAP Attribute Profile with an AttributeValue that has xsi:type="xsd:base64Binary"
static SAMLAttribute buildSAML20LDAPStringTypeAttribute(java.lang.String name, java.lang.String[] stringAttributeValue, java.lang.String friendlyName)
          Create a SAMLAttribute that is valid for the SAML 2.0 X.500 LDAP Attribute Profile with an AttributeValue that has xsi:type="xsd:string".
 void enforceSaml11()
          Removes values from the attribute that are not supported by the SAML v1.1 token type
 void enforceSaml20()
          Removes values from the attribute that are not supported by the SAML v2.0 token type
 java.lang.String getAttributeNamespace()
          Returns the attribute's namespace.
 java.lang.String getEncoding()
          Returns the Encoding setting.
 java.lang.String getFriendlyName()
          Returns the friendly name of the SAML Attribute.
 boolean getLdapType()
          Use this method to see if a SAMLAttribute is X.500 LDAP.
 java.lang.String getName()
          Returns the name of the attribute.
 java.lang.String getNameFormat()
          Returns the attribute attribute's format that specifies how the attribute will be interpreted.
 OMStructure[] getOMAttributeValue()
          Returns an array of the SAMLAttribute's values in OMElement representation.
 java.lang.String[] getStringAttributeValue()
          Returns an array of this SAML attribute's values in string representation.
 com.ibm.websphere.wssecurity.wssapi.XMLStructure[] getXMLAttributeValue()
          Returns an array of this SAML attribute's values in XML form.
 java.lang.String getXsiType()
          Returns the value for the xsi:type for the AttributeValue
 void setEncoding(java.lang.String encoding)
          Sets the x500:Encoding attribute
 void setLdapType(boolean setting)
          Sets the SAMLAttribute to be a SAML 2.0 X.500 LDAP Attribute
 void setXsiType(java.lang.String type)
          Sets the xsi:type for the AttributeValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XSITYPE_NONE

public static java.lang.String XSITYPE_NONE

XSITYPE_XSD_STRING

public static java.lang.String XSITYPE_XSD_STRING

XSITYPE_XSD_BASE64BINARY

public static java.lang.String XSITYPE_XSD_BASE64BINARY
Constructor Detail

SAMLAttribute

public SAMLAttribute(java.lang.String name,
                     java.lang.String[] stringAttributeValue,
                     com.ibm.websphere.wssecurity.wssapi.XMLStructure[] xmlAttributeValue,
                     java.lang.String attributeNamespace,
                     java.lang.String nameFormat,
                     java.lang.String friendlyName)
Constructs a new SAMLAttribute supporting XMLStructure.

Parameters:
name - name of the SAML Attribute
stringAttributeValue - String array containing attribute values in string form.
xmlAttributeValue - XMLStructure array containing attribute values in XML form.
attributeNamespace - attribute's namespace
nameFormat - attribute's format that specifies how the attribute will be interpreted. For example, "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
friendlyName - a friendly name for the attribute, in case the attribute's name is cryptic.

SAMLAttribute

public SAMLAttribute(java.lang.String name,
                     java.lang.String[] stringAttributeValue,
                     OMStructure[] omAttributeValue,
                     java.lang.String attributeNamespace,
                     java.lang.String nameFormat,
                     java.lang.String friendlyName)
Constructs a new SAMLAttribute supporting OMStructure.

Parameters:
name - name of the SAML Attribute
stringAttributeValue - String array containing attribute values in string form.
omAttributeValue - OMStructure array containing attribute values in OMElement form.
attributeNamespace - attribute's namespace
nameFormat - attribute's format that specifies how the attribute will be interpreted. For example, "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
friendlyName - a friendly name for the attribute, in case the attribute's name is cryptic.

SAMLAttribute

public SAMLAttribute(SAMLAttribute anAttribute)
Constructs a new SAMLAttribute that is a copy of the argument SAMLAttribute.

Parameters:
anAttribute - SAMLAttribute to copy

SAMLAttribute

public SAMLAttribute(java.lang.String name,
                     java.lang.String[] stringAttributeValue,
                     OMStructure[] omAttributeValue,
                     java.lang.String attributeNamespace,
                     java.lang.String nameFormat,
                     java.lang.String friendlyName,
                     java.lang.String encoding,
                     java.lang.String xsiType)
Constructs a new SAMLAttribute supporting OMStructure and the additional parameters required for X:500 LDAP.

Parameters:
name - name of the SAML Attribute
stringAttributeValue - String array containing attribute values in string form.
omAttributeValue - OMStructure array containing attribute values in OMElement form.
attributeNamespace - attribute's namespace
nameFormat - attribute's format that specifies how the attribute will be interpreted. For example, "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
friendlyName - a friendly name for the attribute, in case the attribute's name is cryptic.
encoding - attribute's encoding. For example, "LDAP"
xsiType - xsi:type for the AttributeValue. For example, "xsd:string" or "xsd:base64Binary"
Method Detail

buildSAML20Attribute

public static SAMLAttribute buildSAML20Attribute(java.lang.String name,
                                                 java.lang.String[] stringAttributeValue,
                                                 OMStructure[] omAttributeValue,
                                                 java.lang.String nameFormat,
                                                 java.lang.String friendlyName)
Create a SAMLAttribute that is valid for the SAML 2.0 schema.

Parameters:
name - name of the SAML Attribute
stringAttributeValue - String array containing attribute values in string form.
omAttributeValue - OMStructure array containing attribute values in OMElement form.
nameFormat - attribute's format that specifies how the attribute will be interpreted. For example, "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
friendlyName - a friendly name for the attribute, in case the attribute's name is cryptic.
Returns:
SAMLAttribute to use with SAML APIs

buildSAML11Attribute

public static SAMLAttribute buildSAML11Attribute(java.lang.String name,
                                                 java.lang.String[] stringAttributeValue,
                                                 OMStructure[] omAttributeValue,
                                                 java.lang.String attributeNamespace)
Create a SAMLAttribute that is valid for the SAML 1.1 schema.

Parameters:
name - name of the SAML Attribute
stringAttributeValue - String array containing attribute values in string form.
omAttributeValue - OMStructure array containing attribute values in OMElement form.
attributeNamespace - attribute's namespace
Returns:
SAMLAttribute to use with SAML APIs

buildSAML20LDAPStringTypeAttribute

public static SAMLAttribute buildSAML20LDAPStringTypeAttribute(java.lang.String name,
                                                               java.lang.String[] stringAttributeValue,
                                                               java.lang.String friendlyName)
Create a SAMLAttribute that is valid for the SAML 2.0 X.500 LDAP Attribute Profile with an AttributeValue that has xsi:type="xsd:string".

For example, when a SAMLAttribute object is created with the following method:

buildSAML20LDAPStringTypeAttribute("urn:oid:2.5.4.42", new String[]{"Steven"},"givenName");

XML like this will be emitted when the object is serialized:

<saml:Attribute xmlns:x500="urn:oasis:names:tc:SAML:2.0:profiles:attribute:X500" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" Name="urn:oid:2.5.4.42" FriendlyName="givenName" x500:Encoding="LDAP"\> <saml:AttributeValue xsi:type="xsd:string">Steven</saml:AttributeValue></saml:Attribute>

Parameters:
name - name of the SAML Attribute
stringAttributeValue - String array containing attribute values in string form.
friendlyName - a friendly name for the attribute, in case the attribute's name is cryptic.
Returns:
SAMLAttribute to use with SAML APIs

buildSAML20LDAPBase64TypeAttribute

public static SAMLAttribute buildSAML20LDAPBase64TypeAttribute(java.lang.String name,
                                                               java.lang.String[] stringAttributeValue,
                                                               java.lang.String friendlyName)
Create a SAMLAttribute that is valid for the SAML 2.0 X.500 LDAP Attribute Profile with an AttributeValue that has xsi:type="xsd:base64Binary"

Parameters:
name - name of the SAML Attribute
stringAttributeValue - String array containing attribute values in string form.
friendlyName - a friendly name for the attribute, in case the attribute's name is cryptic.
Returns:
SAMLAttribute to use with SAML APIs

getName

public java.lang.String getName()
Returns the name of the attribute.

Returns:
SAML attribute's name

getNameFormat

public java.lang.String getNameFormat()
Returns the attribute attribute's format that specifies how the attribute will be interpreted.

Returns:
SAML attribute's format

getAttributeNamespace

public java.lang.String getAttributeNamespace()
Returns the attribute's namespace.

Returns:
SAML attribute's namespace

getStringAttributeValue

public java.lang.String[] getStringAttributeValue()
Returns an array of this SAML attribute's values in string representation.

Returns:
SAML attribute's string value

getXMLAttributeValue

public com.ibm.websphere.wssecurity.wssapi.XMLStructure[] getXMLAttributeValue()
Returns an array of this SAML attribute's values in XML form.

Returns:
SAML attribute's XML value

getFriendlyName

public java.lang.String getFriendlyName()
Returns the friendly name of the SAML Attribute.

Returns:
SAML attribute's friendly name

enforceSaml20

public void enforceSaml20()
Removes values from the attribute that are not supported by the SAML v2.0 token type


enforceSaml11

public void enforceSaml11()
Removes values from the attribute that are not supported by the SAML v1.1 token type


setLdapType

public void setLdapType(boolean setting)
Sets the SAMLAttribute to be a SAML 2.0 X.500 LDAP Attribute

Parameters:
setting - if true, Encoding is set to "LDAP" and xsiType is set to "xsd:string".

getLdapType

public boolean getLdapType()
Use this method to see if a SAMLAttribute is X.500 LDAP.

Returns:
true if the x500:Encoding attribute is set to "LDAP", otherwise false

getEncoding

public java.lang.String getEncoding()
Returns the Encoding setting. This is the value for the x500:Encoding attribute on the saml:Attribute element if it exists.

Returns:
SAMLAttribute's x500:Encoding value

setEncoding

public void setEncoding(java.lang.String encoding)
Sets the x500:Encoding attribute

Parameters:
encoding - attribute's encoding. For example, "LDAP"

getXsiType

public java.lang.String getXsiType()
Returns the value for the xsi:type for the AttributeValue

Returns:
SAMLAttribute's AttributeValue xsi:type value

setXsiType

public void setXsiType(java.lang.String type)
Sets the xsi:type for the AttributeValue

Parameters:
type - xsi:type for the AttributeValue. For example, "xsd:string" or "xsd:base64Binary"

getOMAttributeValue

public OMStructure[] getOMAttributeValue()
Returns an array of the SAMLAttribute's values in OMElement representation.

Returns:
OMStructure array of SAMLAttribute's AttributeValues

IBM WebSphere Application ServerTM
Release 7