org.opensaml
Class SAMLAssertion

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

public class SAMLAssertion
extends SAMLSignedObject
implements java.lang.Cloneable

Represents a SAML Assertion

Author:
Scott Cantor

Field Summary
protected  java.util.ArrayList advice
           
protected  java.lang.String assertionId
           
protected  java.util.ArrayList conditions
           
protected  java.util.Date issueInstant
           
protected  java.lang.String issuer
           
protected  java.util.Date notBefore
           
protected  java.util.Date notOnOrAfter
           
protected  java.util.ArrayList statements
           
 
Fields inherited from class org.opensaml.SAMLObject
config, log, root
 
Constructor Summary
SAMLAssertion()
          Default constructor
SAMLAssertion(org.w3c.dom.Element e)
          Reconstructs an assertion from a DOM tree
SAMLAssertion(java.io.InputStream in)
          Reconstructs an assertion from a stream
SAMLAssertion(java.lang.String issuer, java.util.Date notBefore, java.util.Date notOnOrAfter, java.util.Collection conditions, java.util.Collection advice, java.util.Collection statements)
          Builds an assertion out of its component parts
 
Method Summary
 void addAdvice(java.lang.Object advice)
          Adds an advice element
 void addCondition(SAMLCondition c)
          Adds a condition to the assertion
 void addStatement(SAMLStatement s)
          Adds a statement to the assertion
 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
 java.util.Iterator getAdvice()
          Gets the optional Advice data included in the assertion Advice can be Strings (assertion references), Assertions, or DOM Elements.
 java.util.Iterator getConditions()
          Gets the conditions included in the assertion
 java.lang.String getId()
          Gets the assertion ID from the assertion
 java.util.Date getIssueInstant()
          Gets the issue timestamp of the assertion
 java.lang.String getIssuer()
          Gets the issuer of the assertion
 java.util.Date getNotBefore()
          Gets the start of the assertion's validity period
 java.util.Date getNotOnOrAfter()
          Gets the end of the assertion's validity period
 java.util.Iterator getStatements()
          Gets the statements included in the assertion
protected  void insertSignature()
          Places the signature into the object's DOM to prepare for signing
 void removeAdvice(int index)
          Removes an advice element by position (zero-based)
 void removeCondition(int index)
          Removes a condition by position (zero-based)
 void removeStatement(int index)
          Removes a statement by position (zero-based)
 void setAdvice(java.util.Collection advice)
          Sets the optional Advice data to include in the assertion
 void setConditions(java.util.Collection conditions)
          Sets the conditions included in the assertion
 void setId(java.lang.String id)
          Sets the assertion ID NOTE: Use this method with caution.
 void setIssueInstant(java.util.Date issueInstant)
          Sets the issue timestamp of the assertion
 void setIssuer(java.lang.String issuer)
          Sets the issuer name
 void setNotBefore(java.util.Date notBefore)
          Sets the start of the assertion's validity period
 void setNotOnOrAfter(java.util.Date notOnOrAfter)
          Sets the end of the assertion's validity period
 void setStatements(java.util.Collection statements)
          Sets the statements to include in the assertion
 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.SAMLSignedObject
getNativeSignature, getSignatureAlgorithm, getSignatureElement, getX509Certificates, isSigned, sign, toDOM, unsign, verify, verify, verify
 
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

assertionId

protected java.lang.String assertionId

issuer

protected java.lang.String issuer

issueInstant

protected java.util.Date issueInstant

notBefore

protected java.util.Date notBefore

notOnOrAfter

protected java.util.Date notOnOrAfter

conditions

protected java.util.ArrayList conditions

advice

protected java.util.ArrayList advice

statements

protected java.util.ArrayList statements
Constructor Detail

SAMLAssertion

public SAMLAssertion()
Default constructor


SAMLAssertion

public SAMLAssertion(java.lang.String issuer,
                     java.util.Date notBefore,
                     java.util.Date notOnOrAfter,
                     java.util.Collection conditions,
                     java.util.Collection advice,
                     java.util.Collection statements)
              throws SAMLException
Builds an assertion out of its component parts

Parameters:
issuer - Name of SAML authority issuing assertion
notBefore - Optional start of validity
notOnOrAfter - Optional end of validity
conditions - Set of conditions on validity
advice - Optional advice content
statements - Set of SAML statements to place in assertion
Throws:
SAMLException - Raised if an assertion cannot be constructed from the supplied information

SAMLAssertion

public SAMLAssertion(org.w3c.dom.Element e)
              throws SAMLException
Reconstructs an assertion from a DOM tree

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

SAMLAssertion

public SAMLAssertion(java.io.InputStream in)
              throws SAMLException
Reconstructs an assertion from a stream

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

insertSignature

protected void insertSignature()
                        throws SAMLException
Places the signature into the object's DOM to prepare for signing

Specified by:
insertSignature in class SAMLSignedObject
Throws:
SAMLException - Thrown if an error occurs while placing the signature

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 SAMLSignedObject
Throws:
SAMLException
See Also:
SAMLObject.fromDOM(org.w3c.dom.Element)

getId

public java.lang.String getId()
Gets the assertion ID from the assertion

Specified by:
getId in class SAMLSignedObject
Returns:
The assertion ID

setId

public void setId(java.lang.String id)
Sets the assertion ID NOTE: Use this method with caution. Assertions must contain unique identifiers and only specialized applications should need to explicitly assign an identifier.

Parameters:
id - The assertion ID

getIssuer

public java.lang.String getIssuer()
Gets the issuer of the assertion

Returns:
The issuer name

setIssuer

public void setIssuer(java.lang.String issuer)
Sets the issuer name

Parameters:
issuer - The issuer name

getIssueInstant

public java.util.Date getIssueInstant()
Gets the issue timestamp of the assertion

Returns:
The issue timestamp

setIssueInstant

public void setIssueInstant(java.util.Date issueInstant)
Sets the issue timestamp of the assertion

Parameters:
issueInstant - The issue timestamp

getNotBefore

public java.util.Date getNotBefore()
Gets the start of the assertion's validity period

Returns:
The starting validity date and time

setNotBefore

public void setNotBefore(java.util.Date notBefore)
Sets the start of the assertion's validity period

Parameters:
notBefore - The starting validity date and time

getNotOnOrAfter

public java.util.Date getNotOnOrAfter()
Gets the end of the assertion's validity period

Returns:
The ending validity date and time

setNotOnOrAfter

public void setNotOnOrAfter(java.util.Date notOnOrAfter)
Sets the end of the assertion's validity period

Parameters:
notOnOrAfter - The ending validity date and time

getConditions

public java.util.Iterator getConditions()
Gets the conditions included in the assertion

Returns:
An iterator of SAML conditions

setConditions

public void setConditions(java.util.Collection conditions)
                   throws SAMLException
Sets the conditions included in the assertion

Parameters:
conditions - The conditions to include in the assertion
Throws:
SAMLException - Raised if any of the conditions are invalid

addCondition

public void addCondition(SAMLCondition c)
                  throws SAMLException
Adds a condition to the assertion

Parameters:
c - The condition to add
Throws:
SAMLException - Raised if an error occurs while adding the condition

removeCondition

public void removeCondition(int index)
                     throws java.lang.IndexOutOfBoundsException
Removes a condition by position (zero-based)

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

getAdvice

public java.util.Iterator getAdvice()
Gets the optional Advice data included in the assertion Advice can be Strings (assertion references), Assertions, or DOM Elements.

Returns:
An iterator over the advice

setAdvice

public void setAdvice(java.util.Collection advice)
               throws SAMLException
Sets the optional Advice data to include in the assertion

Parameters:
advice - The Advice to include in the assertion
Throws:
SAMLException - Raised if unable to construct new Advice objects

addAdvice

public void addAdvice(java.lang.Object advice)
               throws SAMLException
Adds an advice element

Throws:
SAMLException - Raised if object is invalid

removeAdvice

public void removeAdvice(int index)
                  throws java.lang.IndexOutOfBoundsException
Removes an advice element by position (zero-based)

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

getStatements

public java.util.Iterator getStatements()
Gets the statements included in the assertion

Returns:
An iterator of SAML statements

setStatements

public void setStatements(java.util.Collection statements)
                   throws SAMLException
Sets the statements to include in the assertion

Parameters:
statements - The statements to include in the assertion
Throws:
SAMLException - Raised if unable to construct new statement objects

addStatement

public void addStatement(SAMLStatement s)
                  throws SAMLException
Adds a statement to the assertion

Parameters:
s - The statement to add
Throws:
SAMLException - Raised if an error occurs while adding the statement

removeStatement

public void removeStatement(int index)
                     throws java.lang.IndexOutOfBoundsException
Removes a statement by position (zero-based)

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

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 SAMLSignedObject
Returns:
The new object
Throws:
java.lang.CloneNotSupportedException
See Also:
Object.clone()


Copyright ? 2002 UCAID. All Rights Reserved.