Package com.sun.identity.saml.protocol
Class Request
- java.lang.Object
-
- com.sun.identity.saml.protocol.AbstractRequest
-
- com.sun.identity.saml.protocol.Request
-
- Direct Known Subclasses:
FSRequest,FSSAMLRequest
public class Request extends AbstractRequest
ThisRequestclass represents a Request XML document. It extends from the abstract base classAbstractRequest.
-
-
Field Summary
Fields Modifier and Type Field Description protected Listartifactsstatic intASSERTION_ARTIFACTThe request is an Assertion Artifact.static intASSERTION_ID_REFERENCEThe request is an Assertion ID Reference.protected ListassertionIDRefsstatic intATTRIBUTE_QUERYThe request is an Attribute Query.static intAUTHENTICATION_QUERYThe request is an Authentication Query.static intAUTHORIZATION_DECISION_QUERYThe request is an Authorization Decision Query.protected intcontentTypestatic intNOT_SUPPORTEDThe request is not supported.protected Queryqueryprotected StringsignatureStringprotected StringxmlString-
Fields inherited from class com.sun.identity.saml.protocol.AbstractRequest
issueInstant, majorVersion, minorVersion, requestID, respondWiths, signature, signed, valid
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRequest()Request(String requestId, Query query)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(List respondWiths, String requestId, List contents)This constructor shall only be used at the client side to construct a Request object.Request(Element root)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ListgetAssertionArtifact()Gets theAssertionArtifact(s) of the Request.ListgetAssertionIDReference()Gets theAssertionIDReference(s) of the Request.intgetContentType()Returns the type of content this Request has.QuerygetQuery()Gets the query of the Request.static RequestparseXML(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.booleansetSignature(Element elem)Set the signature for the Response.voidsignXML()Method to sign the Request.StringtoString()This method translates the request to an XML document String based on the Request schema described above.StringtoString(boolean includeNS, boolean declareNS)Returns a String representation of the<samlp:Request>element.StringtoString(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 addMajorVersion,MinorVersion, etc. to form a complete Request.- Parameters:
respondWiths- A List of Strings representingRespondWithelements. It could be null when there is no<RespondWith>. Each string could be prefixed bysaml:. If it is not prefixed, or prefixed by a prefix other thansaml:,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 anAuthenticationQuery,AuthorizationDecisionQuery,AttributeQuery, 1 or moreAssertionIDReference, or 1 or more ofAssertionArtifact.- 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 addMajorVersion,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 addMajorVersion,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 anAuthenticationQuery,AuthorizationDecisionQuery,AttributeQuery, 1 or moreAssertionIDReference, or 1 or more ofAssertionArtifact.- Throws:
SAMLException- if an error occurs.
-
Request
public Request(Element root) throws SAMLException
Constructor.- Parameters:
root-Requestelement- Throws:
SAMLException
-
-
Method Detail
-
signXML
public void signXML() throws SAMLExceptionMethod to sign the Request.- Specified by:
signXMLin classAbstractRequest- 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 withRequestID,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
contentTypeof the request is notAUTHENTICATION_QUERY,AUTHORIZATION_DECISION_QUERY, orATTRIBUTE_QUERY.
-
getAssertionIDReference
public List getAssertionIDReference()
Gets theAssertionIDReference(s) of the Request.- Returns:
- a List of
AssertionIDReferences included in the request; orCollections.EMPTY_LISTif thecontentTypeof the request is notASSERTION_ID_REFERENCE.
-
getAssertionArtifact
public List getAssertionArtifact()
Gets theAssertionArtifact(s) of the Request.- Returns:
- a List of
AssertionArtifacts included in the request; orCollections.EMPTY_LISTif thecontentTypeof the request is notASSERTION_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:
setSignaturein classAbstractRequest- Parameters:
elem-ds:Signatureelement- 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 withRequestID,MajorVersion, etc.
-
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 converteddeclareNS- 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 converteddeclareNS- 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
-
-