com.sun.identity.saml.protocol
Class Request

java.lang.Object
  extended by com.sun.identity.saml.protocol.AbstractRequest
      extended by com.sun.identity.saml.protocol.Request
Direct Known Subclasses:
FSSAMLRequest

public class Request
extends AbstractRequest

This Request class represents a Request XML document. It extends from the abstract base class AbstractRequest.


Field Summary
protected  List artifacts
           
static int ASSERTION_ARTIFACT
          The request is an Assertion Artifact.
static int ASSERTION_ID_REFERENCE
          The request is an Assertion ID Reference.
protected  List assertionIDRefs
           
static int ATTRIBUTE_QUERY
          The request is an Attribute Query.
static int AUTHENTICATION_QUERY
          The request is an Authentication Query.
static int AUTHORIZATION_DECISION_QUERY
          The request is an Authorization Decision Query.
protected  int contentType
           
static int NOT_SUPPORTED
          The request is not supported.
protected  Query query
           
protected  String signatureString
           
protected  String xmlString
           
 
Fields inherited from class com.sun.identity.saml.protocol.AbstractRequest
issueInstant, majorVersion, minorVersion, requestID, respondWiths, signature, signed, valid
 
Constructor Summary
protected Request()
           
  Request(Element root)
          Constructor.
  Request(List respondWiths, String requestId, List contents)
          This constructor shall only be used at the client side to construct a Request object.
  Request(String requestId, List contents)
          This constructor shall only be used at the client side to construct a Request object.
  Request(String requestId, Query query)
          This constructor shall only be used at the client side to construct a Request object.
 
Method Summary
 List getAssertionArtifact()
          Gets the AssertionArtifact(s) of the Request.
 List getAssertionIDReference()
          Gets the AssertionIDReference(s) of the Request.
 int getContentType()
          Returns the type of content this Request has.
 Query getQuery()
          Gets the query of the Request.
static Request parseXML(String xml)
          This method shall only be used at the server side to reconstruct a Request object based on the XML document received from client.
 boolean setSignature(Element elem)
          Set the signature for the Response.
 void signXML()
          Method to sign the Request.
 String toString()
          This method translates the request to an XML document String based on the Request schema described above.
 String toString(boolean includeNS, boolean declareNS)
          Returns a String representation of the <samlp:Request> element.
 String toString(boolean includeNS, boolean declareNS, boolean includeHeader)
          Returns a String representation of the <samlp:Request> element.
 
Methods inherited from class com.sun.identity.saml.protocol.AbstractRequest
addRespondWith, getIssueInstant, getMajorVersion, getMinorVersion, getRequestID, getRespondWith, getSignature, isSignatureValid, isSigned, setIssueInstant, setMajorVersion, setMinorVersion, setRequestID
 

Field Detail

query

protected Query query

assertionIDRefs

protected List assertionIDRefs

artifacts

protected List artifacts

contentType

protected int contentType

xmlString

protected String xmlString

signatureString

protected String signatureString

NOT_SUPPORTED

public static final int NOT_SUPPORTED
The request is not supported.

See Also:
Constant Field Values

AUTHENTICATION_QUERY

public static final int AUTHENTICATION_QUERY
The request is an Authentication Query.

See Also:
Constant Field Values

AUTHORIZATION_DECISION_QUERY

public static final int AUTHORIZATION_DECISION_QUERY
The request is an Authorization Decision Query.

See Also:
Constant Field Values

ASSERTION_ID_REFERENCE

public static final int ASSERTION_ID_REFERENCE
The request is an Assertion ID Reference.

See Also:
Constant Field Values

ASSERTION_ARTIFACT

public static final int ASSERTION_ARTIFACT
The request is an Assertion Artifact.

See Also:
Constant Field Values

ATTRIBUTE_QUERY

public static final int ATTRIBUTE_QUERY
The request is an Attribute Query.

See Also:
Constant Field Values
Constructor Detail

Request

protected Request()

Request

public Request(List respondWiths,
               String requestId,
               List contents)
        throws SAMLException
This constructor shall only be used at the client side to construct a Request object. NOTE: The content here is just the body for the Request. The constructor will add MajorVersion, MinorVersion, etc. to form a complete Request.

Parameters:
respondWiths - A List of Strings representing RespondWith elements. It could be null when there is no <RespondWith>. Each string could be prefixed by saml:. If it is not prefixed, or prefixed by a prefix other than saml:, saml: will be used instead.
requestId - If it's null, the constructor will create one.
contents - A List of objects that are the contents of Request that the client wants to send to the server. It could be an AuthenticationQuery, AuthorizationDecisionQuery, AttributeQuery, 1 or more AssertionIDReference, or 1 or more of AssertionArtifact.
Throws:
SAMLException - if an error occurs.

Request

public Request(String requestId,
               Query query)
        throws SAMLException
This constructor shall only be used at the client side to construct a Request object. NOTE: The content here is just the body for the Request. The constructor will add MajorVersion, MinorVersion, etc. to form a complete Request.

Parameters:
requestId - If it's null, the constructor will create one.
query - A Query to be included in the Request.
Throws:
SAMLException - if an error occurs.

Request

public Request(String requestId,
               List contents)
        throws SAMLException
This constructor shall only be used at the client side to construct a Request object. NOTE: The content here is just the body for the Request. The constructor will add MajorVersion, MinorVersion, etc. to form a complete Request.

Parameters:
requestId - If it's null, the constructor will create one.
contents - A List of objects that are the contents of Request that the client wants to send to the server. It could be an AuthenticationQuery, AuthorizationDecisionQuery, AttributeQuery, 1 or more AssertionIDReference, or 1 or more of AssertionArtifact.
Throws:
SAMLException - if an error occurs.

Request

public Request(Element root)
        throws SAMLException
Constructor.

Parameters:
root - Request element
Throws:
SAMLException
Method Detail

signXML

public void signXML()
             throws SAMLException
Method to sign the Request.

Specified by:
signXML in class AbstractRequest
Throws:
SAMLException - if could not sign the Request.

parseXML

public static Request parseXML(String xml)
                        throws SAMLException
This method shall only be used at the server side to reconstruct a Request object based on the XML document received from client. The schema of this XML document is described above.

Parameters:
xml - The Request XML String. NOTE: this is a complete SAML request XML string with RequestID, MajorVersion, etc.
Returns:
Request object
Throws:
SAMLException - if an error occurs.

getQuery

public Query getQuery()
Gets the query of the Request.

Returns:
the query included in the request; or null if the contentType of the request is not AUTHENTICATION_QUERY, AUTHORIZATION_DECISION_QUERY, or ATTRIBUTE_QUERY.

getAssertionIDReference

public List getAssertionIDReference()
Gets the AssertionIDReference(s) of the Request.

Returns:
a List of AssertionIDReferences included in the request; or Collections.EMPTY_LIST if the contentType of the request is not ASSERTION_ID_REFERENCE.

getAssertionArtifact

public List getAssertionArtifact()
Gets the AssertionArtifact(s) of the Request.

Returns:
a List of AssertionArtifacts included in the request; or Collections.EMPTY_LIST if the contentType of the request is not ASSERTION_ARTIFACT.

getContentType

public int getContentType()
Returns the type of content this Request has.

Returns:
The type of the content. The possible values are defined in Request.

setSignature

public boolean setSignature(Element elem)
Set the signature for the Response.

Overrides:
setSignature in class AbstractRequest
Parameters:
elem - ds:Signature element
Returns:
true if the operation succeeds.

toString

public String toString()
This method translates the request to an XML document String based on the Request schema described above. NOTE: this is a complete SAML request XML string with RequestID, MajorVersion, etc.

Overrides:
toString in class Object
Returns:
An XML String representing the request.

toString

public String toString(boolean includeNS,
                       boolean declareNS)
Returns a String representation of the <samlp:Request> element.

Parameters:
includeNS - Determines whether or not the namespace qualifier is prepended to the Element when converted
declareNS - Determines whether or not the namespace is declared within the Element.
Returns:
A string containing the valid XML for this element

toString

public String toString(boolean includeNS,
                       boolean declareNS,
                       boolean includeHeader)
Returns a String representation of the <samlp:Request> element.

Parameters:
includeNS - Determines whether or not the namespace qualifier is prepended to the Element when converted
declareNS - Determines whether or not the namespace is declared within the Element.
includeHeader - Determines whether the output include the XML declaration header.
Returns:
A string containing the valid XML for this element