org.opensaml
Class SAMLSubject

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

public class SAMLSubject
extends SAMLObject
implements Cloneable

Represents a SAML Subject

Author:
Scott Cantor

Field Summary
static String CONF_ARTIFACT
          Artifact Confirmation Method Identifier
static String CONF_ARTIFACT01
          Deprecated. Deprecated artifact Confirmation Method Identifier
static String CONF_BEARER
          Assertion Bearer Confirmation Method Identifier
static String CONF_HOLDER_KEY
          Holder of Key Confirmation Method Identifier
static String CONF_SENDER_VOUCHES
          Sender Vouches Confirmation Method Identifier
protected  Element confirmationData
           
protected  ArrayList confirmationMethods
           
protected  org.apache.xml.security.keys.KeyInfo keyInfo
           
protected  SAMLNameIdentifier nameId
           
 
Fields inherited from class org.opensaml.SAMLObject
config, dirty, log, parentObject, root
 
Constructor Summary
SAMLSubject()
          Default constructor
SAMLSubject(Element e)
          Reconstructs a subject from a DOM tree
SAMLSubject(InputStream in)
          Reconstructs a subject from a stream
SAMLSubject(SAMLNameIdentifier nameId, Collection confirmationMethods, Element confirmationData, Object keyInfo)
          Builds a subject out of its component parts
 
Method Summary
 void addConfirmationMethod(String confirmationMethod)
          Adds a confirmation method to the Subject
protected  Element buildRoot(Document doc, boolean xmlns)
          Delegates the process of building the root element of an object and inserting appropriate namespaces.
 void checkValidity()
          Evaluates the object's content to see if it is currently valid if serialized.
 Object clone()
          Copies a SAML object such that no dependencies exist between the original and the copy
 void fromDOM(Element e)
          Initialization of an object from a DOM element
 Element getConfirmationData()
          Gets the optional confirmation data of the Subject
 Iterator getConfirmationMethods()
          Gets the confirmation methods of the Subject
 Element getKeyInfo()
          Gets the ds:KeyInfo DOM that is included in the subject, if any
 SAMLNameIdentifier getNameIdentifier()
          Gets the name identifier of the Subject
 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(Element confirmationData)
          Sets the optional confirmation data of the Subject
 void setConfirmationMethods(Collection confirmationMethods)
          Sets the confirmation methods of the Subject
 void setKeyInfo(Object keyInfo)
          Sets the ds:KeyInfo of the Subject
 void setNameIdentifier(SAMLNameIdentifier nameId)
          Sets the name identifier of the Subject
 Node toDOM(Document doc, boolean xmlns)
          Transforms the object into a DOM tree using an existing document context
 
Methods inherited from class org.opensaml.SAMLObject
fromStream, fromStream, getParent, plantRoot, setDirty, setParent, toBase64, toDOM, 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 ArrayList confirmationMethods

confirmationData

protected Element confirmationData

keyInfo

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

CONF_ARTIFACT

public static final String CONF_ARTIFACT
Artifact Confirmation Method Identifier

See Also:
Constant Field Values

CONF_ARTIFACT01

public static final String CONF_ARTIFACT01
Deprecated. Deprecated artifact Confirmation Method Identifier

See Also:
Constant Field Values

CONF_BEARER

public static final String CONF_BEARER
Assertion Bearer Confirmation Method Identifier

See Also:
Constant Field Values

CONF_HOLDER_KEY

public static final String CONF_HOLDER_KEY
Holder of Key Confirmation Method Identifier

See Also:
Constant Field Values

CONF_SENDER_VOUCHES

public static final 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,
                   Collection confirmationMethods,
                   Element confirmationData,
                   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 (optional)
Throws:
SAMLException - Raised if a subject cannot be constructed from the supplied information

SAMLSubject

public SAMLSubject(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(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(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)

getNameIdentifier

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

Returns:
The name identifier

setNameIdentifier

public void setNameIdentifier(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 Iterator getConfirmationMethods()
Gets the confirmation methods of the Subject

Returns:
An iterator of Subject confirmation method URIs

setConfirmationMethods

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

Parameters:
confirmationMethods - The confirmation methods

addConfirmationMethod

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

Parameters:
confirmationMethod - The method URI to add

removeConfirmationMethod

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

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

getConfirmationData

public Element getConfirmationData()
Gets the optional confirmation data of the Subject

Returns:
The saml:SubjectConfirmationData element

setConfirmationData

public void setConfirmationData(Element confirmationData)
Sets the optional confirmation data of the Subject

Parameters:
confirmationData - The saml:SubjectConfirmationData element

getKeyInfo

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

Returns:
Root of the ds:KeyInfo DOM

getNativeKeyInfo

public 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(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

buildRoot

protected Element buildRoot(Document doc,
                            boolean xmlns)
Description copied from class: SAMLObject
Delegates the process of building the root element of an object and inserting appropriate namespaces.

Specified by:
buildRoot in class SAMLObject
Parameters:
doc - The document context to use
xmlns - Include namespace(s) on root element?
Returns:
A new root element for the object
See Also:
SAMLObject.buildRoot(org.w3c.dom.Document,boolean)

toDOM

public Node toDOM(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.checkValidity() would succeed, while SAMLStatement.checkValidity would raise an exception.

Specified by:
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 Object clone()
             throws 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:
CloneNotSupportedException
See Also:
Object.clone()


Copyright ? 2005 UCAID. All Rights Reserved.