org.opensaml
Class SAMLResponse

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

public class SAMLResponse
extends SAMLSignedObject

Represents a SAML protocol response

Author:
Scott Cantor

Field Summary
protected  java.util.ArrayList assertions
           
protected  SAMLException e
           
protected  java.lang.String inResponseTo
           
protected  java.util.Date issueInstant
           
protected  java.lang.String recipient
           
protected  java.lang.String responseId
           
 
Fields inherited from class org.opensaml.SAMLObject
config, log, root
 
Constructor Summary
SAMLResponse()
          Default constructor
SAMLResponse(org.w3c.dom.Element e)
          Reconstructs a response from a DOM tree
SAMLResponse(java.io.InputStream in)
          Reconstructs a response from a stream
SAMLResponse(java.lang.String inResponseTo, java.lang.String recipient, java.util.Collection assertions, SAMLException e)
          Builds a SAML response out of its component parts
 
Method Summary
 void addAssertion(SAMLAssertion assertion)
          Adds an assertion to the response
 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 getAssertions()
          Gets the SAML assertions contained in the response, if any
 java.lang.String getId()
          Gets the response ID
 java.lang.String getInResponseTo()
          Gets the InResponseTo attribute
 java.util.Date getIssueInstant()
          Gets the issue timestamp of the SAML response
 java.lang.String getRecipient()
          Gets the Recipient attribute of the SAML response
protected  void insertSignature()
          Places the signature into the object's DOM to prepare for signing
 void removeAssertion(int index)
          Removes assertion by position (zero-based)
 void setAssertions(java.util.Collection assertions)
          Sets the SAML assertions to include in the response
 void setId(java.lang.String id)
          Sets the response ID NOTE: Use this method with caution.
 void setInResponseTo(java.lang.String inResponseTo)
          Sets the InResponseTo attribute
 void setIssueInstant(java.util.Date issueInstant)
          Sets the issue timestamp of the response
 void setRecipient(java.lang.String recipient)
          Sets the Recipient attribute
 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
checkValidity, 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

responseId

protected java.lang.String responseId

inResponseTo

protected java.lang.String inResponseTo

issueInstant

protected java.util.Date issueInstant

recipient

protected java.lang.String recipient

assertions

protected java.util.ArrayList assertions

e

protected SAMLException e
Constructor Detail

SAMLResponse

public SAMLResponse()
Default constructor


SAMLResponse

public SAMLResponse(java.lang.String inResponseTo,
                    java.lang.String recipient,
                    java.util.Collection assertions,
                    SAMLException e)
             throws SAMLException
Builds a SAML response out of its component parts

If a signature object is provided, it is annotated with transforms to sign the entire response and use the SHA-1 digest algorithm.

Parameters:
inResponseTo - The request ID that prompted the response, if any
recipient - The URL of the intended recipient of the response
assertions - The SAML assertion(s) to return in the response, if any
e - The SAML error status information to return in the response, if any
Throws:
SAMLException - Raised if a response cannot be constructed from the supplied information

SAMLResponse

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

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

SAMLResponse

public SAMLResponse(java.io.InputStream in)
             throws SAMLException
Reconstructs a response 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 response ID

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

setId

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

Parameters:
id - The response ID

getInResponseTo

public java.lang.String getInResponseTo()
Gets the InResponseTo attribute

Returns:
The InResponseTo value

setInResponseTo

public void setInResponseTo(java.lang.String inResponseTo)
Sets the InResponseTo attribute

Parameters:
inResponseTo - The InResponseTo value

getIssueInstant

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

Returns:
The issue timestamp

setIssueInstant

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

Parameters:
issueInstant - The issue timestamp

getRecipient

public java.lang.String getRecipient()
Gets the Recipient attribute of the SAML response

Returns:
The Recipient value

setRecipient

public void setRecipient(java.lang.String recipient)
Sets the Recipient attribute

Parameters:
recipient - The Recipient value

getAssertions

public java.util.Iterator getAssertions()
Gets the SAML assertions contained in the response, if any

Returns:
The assertions in the response

setAssertions

public void setAssertions(java.util.Collection assertions)
                   throws SAMLException
Sets the SAML assertions to include in the response

Parameters:
assertions - The assertions to include
Throws:
SAMLException - Raised if the assertions are invalid

addAssertion

public void addAssertion(SAMLAssertion assertion)
                  throws SAMLException
Adds an assertion to the response

Parameters:
assertion - The assertion to add
Throws:
SAMLException - Raised if the assertion is invalid

removeAssertion

public void removeAssertion(int index)
                     throws java.lang.IndexOutOfBoundsException
Removes assertion by position (zero-based)

Parameters:
index - The position of the assertion 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)

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.