org.opensaml
Class SAMLRequest

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

public class SAMLRequest
extends SAMLSignedObject
implements java.lang.Cloneable

Represents a SAML protocol request

Author:
Scott Cantor

Field Summary
protected  java.util.ArrayList artifacts
           
protected  java.util.ArrayList assertionIdRefs
           
protected  java.util.Date issueInstant
           
protected  SAMLQuery query
           
protected  java.lang.String requestId
           
protected  java.util.ArrayList respondWiths
           
 
Fields inherited from class org.opensaml.SAMLObject
config, log, root
 
Constructor Summary
SAMLRequest()
          Default constructor
SAMLRequest(java.util.Collection respondWiths, SAMLQuery query, java.util.Collection assertionIdRefs, java.util.Collection artifacts)
          Builds a SAML request out of its component parts
SAMLRequest(org.w3c.dom.Element e)
          Reconstructs a request from a DOM tree
SAMLRequest(java.io.InputStream in)
          Reconstructs a request from a stream
 
Method Summary
 void addArtifact(java.lang.String artifact)
          Adds an artifact to the request
 void addAssertionIdRef(java.lang.String ref)
          Adds an assertion ID reference to the request
 void addRespondWith(QName respondWith)
          Adds a statement type to the request
 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 getArtifacts()
          Gets the artifacts contained within the request
 java.util.Iterator getAssertionIdRefs()
          Gets the assertion ID references contained within the request
 java.lang.String getId()
          Gets the request ID
 java.util.Date getIssueInstant()
          Gets the issue timestamp of the request
 SAMLQuery getQuery()
          Gets the query contained within the request
 java.util.Iterator getRespondWiths()
          Gets the types of statements the requester is prepared to accept
protected  void insertSignature()
          Places the signature into the object's DOM to prepare for signing
 void removeArtifact(int index)
          Removes an artifact by position (zero-based)
 void removeAssertionIdRef(int index)
          Removes an assertion reference by position (zero-based)
 void removeRespondWith(int index)
          Removes a statement type by position (zero-based)
 void setArtifacts(java.util.Collection artifacts)
          Sets the artifacts contained within the request
 void setAssertionIdRefs(java.util.Collection refs)
          Sets the assertion ID references contained within the request
 void setId(java.lang.String id)
          Sets the request ID NOTE: Use this method with caution.
 void setIssueInstant(java.util.Date issueInstant)
          Sets the issue timestamp of the request
 void setQuery(SAMLQuery query)
          Sets the query contained within the request
 void setRespondWiths(java.util.Collection respondWiths)
          Sets the types of statements the requester is prepared to accept
 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

requestId

protected java.lang.String requestId

issueInstant

protected java.util.Date issueInstant

respondWiths

protected java.util.ArrayList respondWiths

query

protected SAMLQuery query

assertionIdRefs

protected java.util.ArrayList assertionIdRefs

artifacts

protected java.util.ArrayList artifacts
Constructor Detail

SAMLRequest

public SAMLRequest()
Default constructor


SAMLRequest

public SAMLRequest(java.util.Collection respondWiths,
                   SAMLQuery query,
                   java.util.Collection assertionIdRefs,
                   java.util.Collection artifacts)
            throws SAMLException
Builds a SAML request out of its component parts

The last three parameters are mutually exclusive of each other, and two of them should be null. They will be evaluated in order.

Parameters:
respondWiths - The types of SAML statements (as QNames) to accept in the query response
query - A query to place in the request
assertionIdRefs - A set of AssertionIDRef values to dereference
artifacts - A set of artifacts to dereference
Throws:
SAMLException - Thrown if a request cannot be constructed from the supplied information

SAMLRequest

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

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

SAMLRequest

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

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

setId

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

Parameters:
id - The request ID

getIssueInstant

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

Returns:
The issue timestamp

setIssueInstant

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

Parameters:
issueInstant - The issue timestamp

getRespondWiths

public java.util.Iterator getRespondWiths()
Gets the types of statements the requester is prepared to accept

Returns:
An iterator of QNames representing statement types

setRespondWiths

public void setRespondWiths(java.util.Collection respondWiths)
Sets the types of statements the requester is prepared to accept

Parameters:
respondWiths - An iterator of QNames representing statement types

addRespondWith

public void addRespondWith(QName respondWith)
Adds a statement type to the request

Parameters:
respondWith - The type to add

removeRespondWith

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

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

getQuery

public SAMLQuery getQuery()
Gets the query contained within the request

Returns:
The query in the request

setQuery

public void setQuery(SAMLQuery query)
              throws SAMLException
Sets the query contained within the request

Parameters:
query - The query for the request
Throws:
SAMLException - Raised if the query is invalid

getAssertionIdRefs

public java.util.Iterator getAssertionIdRefs()
Gets the assertion ID references contained within the request

Returns:
An iterator over the references

addAssertionIdRef

public void addAssertionIdRef(java.lang.String ref)
Adds an assertion ID reference to the request

Parameters:
ref - The reference to add

setAssertionIdRefs

public void setAssertionIdRefs(java.util.Collection refs)
Sets the assertion ID references contained within the request

Parameters:
refs - The references to include

removeAssertionIdRef

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

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

getArtifacts

public java.util.Iterator getArtifacts()
Gets the artifacts contained within the request

Returns:
An iterator over the artifacts

setArtifacts

public void setArtifacts(java.util.Collection artifacts)
Sets the artifacts contained within the request


addArtifact

public void addArtifact(java.lang.String artifact)
Adds an artifact to the request

Parameters:
artifact - The artifact to add

removeArtifact

public void removeArtifact(int index)
                    throws java.lang.IndexOutOfBoundsException
Removes an artifact by position (zero-based)

Parameters:
index - The position of the artifact 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.