org.opensaml
Class SAMLRequest

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

public class SAMLRequest
extends SAMLSignedObject
implements Cloneable

Represents a SAML protocol request

Author:
Scott Cantor

Field Summary
protected  ArrayList artifacts
           
protected  ArrayList assertionIdRefs
           
protected  Date issueInstant
           
protected  int minor
           
protected  SAMLQuery query
           
protected  String requestId
           
protected  ArrayList respondWiths
           
 
Fields inherited from class org.opensaml.SAMLObject
config, dirty, log, parentObject, root
 
Constructor Summary
SAMLRequest()
          Default constructor
SAMLRequest(Collection artifactsOrIdRefs)
          Builds a SAML request using artifacts or assertion references
SAMLRequest(Collection artifactsOrIdRefs, String requestId, Date issueInstant)
          Builds a SAML request using artifacts or assertion references
SAMLRequest(Element e)
          Reconstructs a request from a DOM tree
SAMLRequest(InputStream in)
          Reconstructs a request from a stream
SAMLRequest(InputStream in, int minor)
          Reconstructs a request of a particular minor version from a stream
SAMLRequest(SAMLQuery query)
          Builds a SAML request using a query
SAMLRequest(SAMLQuery query, String requestId, Date issueInstant)
          Builds a SAML request using a query
 
Method Summary
 void addArtifact(Artifact artifact)
          Adds an artifact to the request
 void addAssertionIdRef(String ref)
          Adds an assertion ID reference to the request
 void addRespondWith(QName respondWith)
          Adds a statement type to the request
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
 Iterator getArtifacts()
          Gets the artifacts contained within the request
 Iterator getAssertionIdRefs()
          Gets the assertion ID references contained within the request
 String getId()
          Gets the request ID
 Date getIssueInstant()
          Gets the issue timestamp of the request
 int getMinorVersion()
          Gets the MinorVersion of the request.
 SAMLQuery getQuery()
          Gets the query contained within the request
 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(Collection artifacts)
          Sets the artifacts contained within the request
 void setAssertionIdRefs(Collection refs)
          Sets the assertion ID references contained within the request
 void setId(String id)
          Sets the request ID NOTE: Use this method with caution.
 void setIssueInstant(Date issueInstant)
          Sets the issue timestamp of the request
 void setMinorVersion(int minor)
          Sets the MinorVersion of the request
 void setQuery(SAMLQuery query)
          Sets the query contained within the request
 void setRespondWiths(Collection respondWiths)
          Sets the types of statements the requester is prepared to accept
 Node toDOM(Document doc, boolean xmlns)
          Transforms the object into a DOM tree using an existing document context
 
Methods inherited from class org.opensaml.SAMLSignedObject
getDigestAlgorithm, getNativeSignature, getSignatureAlgorithm, getSignatureElement, getX509Certificates, isSigned, setDirty, sign, sign, toDOM, unsign, verify, verify, verify
 
Methods inherited from class org.opensaml.SAMLObject
fromStream, fromStream, getParent, plantRoot, setParent, toBase64, toDOM, toDOM, toStream, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

minor

protected int minor

requestId

protected String requestId

issueInstant

protected Date issueInstant

respondWiths

protected ArrayList respondWiths

query

protected SAMLQuery query

assertionIdRefs

protected ArrayList assertionIdRefs

artifacts

protected ArrayList artifacts
Constructor Detail

SAMLRequest

public SAMLRequest()
Default constructor


SAMLRequest

public SAMLRequest(SAMLQuery query)
            throws SAMLException
Builds a SAML request using a query

Parameters:
query - A query to place in the request
Throws:
SAMLException - Thrown if a request cannot be constructed from the supplied information

SAMLRequest

public SAMLRequest(SAMLQuery query,
                   String requestId,
                   Date issueInstant)
            throws SAMLException
Builds a SAML request using a query

Parameters:
query - A query to place in the request
requestId - Unique identifier for request
issueInstant - Time of issuance
Throws:
SAMLException - Thrown if a request cannot be constructed from the supplied information

SAMLRequest

public SAMLRequest(Collection artifactsOrIdRefs)
            throws SAMLException
Builds a SAML request using artifacts or assertion references

Parameters:
artifactsOrIdRefs - A collection of Artifacts or Strings (but not both)
Throws:
SAMLException - Thrown if a request cannot be constructed from the supplied information

SAMLRequest

public SAMLRequest(Collection artifactsOrIdRefs,
                   String requestId,
                   Date issueInstant)
            throws SAMLException
Builds a SAML request using artifacts or assertion references

Parameters:
artifactsOrIdRefs - A collection of Artifacts or Strings (but not both)
requestId - Unique identifier for request
issueInstant - Time of issuance
Throws:
SAMLException - Thrown if a request cannot be constructed from the supplied information

SAMLRequest

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

SAMLRequest

public SAMLRequest(InputStream in,
                   int minor)
            throws SAMLException
Reconstructs a request of a particular minor version from a stream

Parameters:
in - A stream containing XML
minor - The minor version of the incoming request
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(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)

getMinorVersion

public int getMinorVersion()
Gets the MinorVersion of the request.

Returns:
The minor version

setMinorVersion

public void setMinorVersion(int minor)
Sets the MinorVersion of the request

Parameters:
minor - The minor version

getId

public String getId()
Gets the request ID

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

setId

public void setId(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 Date getIssueInstant()
Gets the issue timestamp of the request

Returns:
The issue timestamp

setIssueInstant

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

Parameters:
issueInstant - The issue timestamp

getRespondWiths

public 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(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 IndexOutOfBoundsException
Removes a statement type by position (zero-based)

Parameters:
index - The position of the statement type to remove
Throws:
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 Iterator getAssertionIdRefs()
Gets the assertion ID references contained within the request

Returns:
An iterator over the references

addAssertionIdRef

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

Parameters:
ref - The reference to add

setAssertionIdRefs

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

Parameters:
refs - The references to include

removeAssertionIdRef

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

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

getArtifacts

public Iterator getArtifacts()
Gets the artifacts contained within the request

Returns:
An iterator over the artifacts

setArtifacts

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


addArtifact

public void addArtifact(Artifact artifact)
Adds an artifact to the request

Parameters:
artifact - The artifact to add

removeArtifact

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

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

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


Copyright ? 2005 UCAID. All Rights Reserved.