org.opensaml
Class SAMLSubject

java.lang.Object
  extended byorg.opensaml.SAMLObject
      extended byorg.opensaml.SAMLSubject
All Implemented Interfaces:
java.lang.Cloneable

public class SAMLSubject
extends SAMLObject
implements java.lang.Cloneable

Represents a SAML Subject

Author:
Scott Cantor

Field Summary
static java.lang.String CONF_ARTIFACT
          Type 01 Artifact Confirmation Method Identifier
static java.lang.String CONF_BEARER
          Assertion Bearer Confirmation Method Identifier
static java.lang.String CONF_HOLDER_KEY
          Holder of Key Confirmation Method Identifier
static java.lang.String CONF_SENDER_VOUCHES
          Sender Vouches Confirmation Method Identifier
protected  org.w3c.dom.Element confirmationData
           
protected  java.util.ArrayList confirmationMethods
           
protected  org.apache.xml.security.keys.KeyInfo keyInfo
           
protected  SAMLNameIdentifier nameId
           
 
Fields inherited from class org.opensaml.SAMLObject
config, log, root
 
Constructor Summary
SAMLSubject()
          Default constructor
SAMLSubject(org.w3c.dom.Element e)
          Reconstructs a subject from a DOM tree
SAMLSubject(java.io.InputStream in)
          Reconstructs a subject from a stream
SAMLSubject(SAMLNameIdentifier nameId, java.util.Collection confirmationMethods, org.w3c.dom.Element confirmationData, java.lang.Object keyInfo)
          Builds a subject out of its component parts
 
Method Summary
 void addConfirmationMethod(java.lang.String confirmationMethod)
          Adds a confirmation method to the Subject
 void checkValidity()
          Evaluates the object's content to see if it is currently valid if serialized.
 java.lang.Object clone()
          Copies a SAML object such that no dependencies exist between the original and the copy
 void fromDOM(org.w3c.dom.Element e)
          Initialization of an object from a DOM element
 org.w3c.dom.Element getConfirmationData()
          Gets the optional confirmation data of the Subject
 java.util.Iterator getConfirmationMethods()
          Gets the confirmation methods of the Subject
 org.w3c.dom.Element getKeyInfo()
          Gets the ds:KeyInfo DOM that is included in the subject, if any
 SAMLNameIdentifier getName()
          Gets the name identifier of the Subject
 java.lang.Object getNativeKeyInfo()
          Gets the native library object for the ds:KeyInfo that is included in the subject, if any
 void removeConfirmationMethod(int index)
          Removes a confirmation method by position (zero-based)
 void setConfirmationData(org.w3c.dom.Element confirmationData)
          Sets the optional confirmation data of the Subject
 void setConfirmationMethods(java.util.Collection confirmationMethods)
          Sets the confirmation methods of the Subject
 void setKeyInfo(java.lang.Object keyInfo)
          Sets the ds:KeyInfo of the Subject
 void setName(SAMLNameIdentifier nameId)
          Sets the name identifier of the Subject
 org.w3c.dom.Node toDOM()
          Transforms the object into a DOM tree without an existing document context, including namespace declarations
 org.w3c.dom.Node toDOM(org.w3c.dom.Document doc, boolean xmlns)
          Transforms the object into a DOM tree using an existing document context
 
Methods inherited from class org.opensaml.SAMLObject
fromStream, plantRoot, toBase64, toDOM, toDOM, toStream, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nameId

protected SAMLNameIdentifier nameId

confirmationMethods

protected java.util.ArrayList confirmationMethods

confirmationData

protected org.w3c.dom.Element confirmationData

keyInfo

protected org.apache.xml.security.keys.KeyInfo keyInfo

CONF_ARTIFACT

public static final java.lang.String CONF_ARTIFACT
Type 01 Artifact Confirmation Method Identifier

See Also:
Constant Field Values

CONF_BEARER

public static final java.lang.String CONF_BEARER
Assertion Bearer Confirmation Method Identifier

See Also:
Constant Field Values

CONF_HOLDER_KEY

public static final java.lang.String CONF_HOLDER_KEY
Holder of Key Confirmation Method Identifier

See Also:
Constant Field Values

CONF_SENDER_VOUCHES

public static final java.lang.String CONF_SENDER_VOUCHES
Sender Vouches Confirmation Method Identifier

See Also:
Constant Field Values
Constructor Detail

SAMLSubject

public SAMLSubject()
Default constructor


SAMLSubject

public SAMLSubject(SAMLNameIdentifier nameId,
                   java.util.Collection confirmationMethods,
                   org.w3c.dom.Element confirmationData,
                   java.lang.Object keyInfo)
            throws SAMLException
Builds a subject out of its component parts

Parameters:
nameId - Name of subject (optional)
confirmationMethods - Confirmation method(s) that bind the subject to an enclosing assertion (optional)
confirmationData - Arbitrary confirmation data DOM (optional)
keyInfo - A ds:KeyInfo, either from an xmlsig library or a DOM element
Throws:
SAMLException - Raised if a subject cannot be constructed from the supplied information

SAMLSubject

public SAMLSubject(org.w3c.dom.Element e)
            throws SAMLException
Reconstructs a subject from a DOM tree

Parameters:
e - The root of a DOM tree
Throws:
SAMLException - Thrown if the object cannot be constructed

SAMLSubject

public SAMLSubject(java.io.InputStream in)
            throws SAMLException
Reconstructs a subject from a stream

Parameters:
in - A stream containing XML
Throws:
SAMLException - Raised if an exception occurs while constructing the object.
Method Detail

fromDOM

public void fromDOM(org.w3c.dom.Element e)
             throws SAMLException
Description copied from class: SAMLObject
Initialization of an object from a DOM element

Overrides:
fromDOM in class SAMLObject
Parameters:
e - Root element of a DOM tree
Throws:
SAMLException - Raised if an exception occurs while constructing the object
See Also:
SAMLObject.fromDOM(org.w3c.dom.Element)

getName

public SAMLNameIdentifier getName()
Gets the name identifier of the Subject

Returns:
The name identifier

setName

public void setName(SAMLNameIdentifier nameId)
             throws SAMLException
Sets the name identifier of the Subject

Parameters:
nameId - The name identifier
Throws:
SAMLException - Raised if the object is invalid

getConfirmationMethods

public java.util.Iterator getConfirmationMethods()
Gets the confirmation methods of the Subject

Returns:
An iterator of Subject confirmation method URIs

setConfirmationMethods

public void setConfirmationMethods(java.util.Collection confirmationMethods)
Sets the confirmation methods of the Subject

Parameters:
confirmationMethods - The confirmation methods

addConfirmationMethod

public void addConfirmationMethod(java.lang.String confirmationMethod)
Adds a confirmation method to the Subject

Parameters:
confirmationMethod - The method URI to add

removeConfirmationMethod

public void removeConfirmationMethod(int index)
                              throws java.lang.IndexOutOfBoundsException
Removes a confirmation method by position (zero-based)

Parameters:
index - The position of the method to remove
Throws:
java.lang.IndexOutOfBoundsException

getConfirmationData

public org.w3c.dom.Element getConfirmationData()
Gets the optional confirmation data of the Subject

Returns:
The saml:SubjectConfirmationData element

setConfirmationData

public void setConfirmationData(org.w3c.dom.Element confirmationData)
Sets the optional confirmation data of the Subject

Parameters:
confirmationData - The saml:SubjectConfirmationData element

getKeyInfo

public org.w3c.dom.Element getKeyInfo()
Gets the ds:KeyInfo DOM that is included in the subject, if any

Returns:
Root of the ds:KeyInfo DOM

getNativeKeyInfo

public java.lang.Object getNativeKeyInfo()
Gets the native library object for the ds:KeyInfo that is included in the subject, if any

Returns:
The native library object containing the ds:KeyInfo

setKeyInfo

public void setKeyInfo(java.lang.Object keyInfo)
                throws SAMLException
Sets the ds:KeyInfo of the Subject

Parameters:
keyInfo - The ds:KeyInfo DOM or native library object
Throws:
SAMLException - Raised if the object is invalid

toDOM

public org.w3c.dom.Node toDOM()
                       throws SAMLException
Description copied from class: SAMLObject
Transforms the object into a DOM tree without an existing document context, including namespace declarations

Overrides:
toDOM in class SAMLObject
Returns:
Root element node of the DOM tree capturing the object
Throws:
SAMLException - Raised if the object is incompletely defined
See Also:
SAMLObject.toDOM()

toDOM

public org.w3c.dom.Node toDOM(org.w3c.dom.Document doc,
                              boolean xmlns)
                       throws SAMLException
Description copied from class: SAMLObject
Transforms the object into a DOM tree using an existing document context

Overrides:
toDOM in class SAMLObject
Parameters:
doc - A Document object to use in manufacturing the tree
xmlns - Include namespace(s) on root element?
Returns:
Root element node of the DOM tree capturing the object
Throws:
SAMLException - Raised if the object is incompletely defined
See Also:
SAMLObject.toDOM(org.w3c.dom.Document,boolean)

checkValidity

public void checkValidity()
                   throws SAMLException
Description copied from class: SAMLObject
Evaluates the object's content to see if it is currently valid if serialized. Does not evaluate embedded objects except on the basis of whether they exist. For example, an Assertion must have a Statement, but if an invalid statement is added, SAMLAssertion.isValid() would succeed, while SAMLStatement.isValid would raise an exception.

Overrides:
checkValidity in class SAMLObject
Throws:
SAMLException - Raised if the serialized object would be invalid SAML, excluding any embedded objects
See Also:
SAMLObject.checkValidity()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Copies a SAML object such that no dependencies exist between the original and the copy

Overrides:
clone in class SAMLObject
Returns:
The new object
Throws:
java.lang.CloneNotSupportedException
See Also:
Object.clone()


Copyright ? 2002 UCAID. All Rights Reserved.