public class Response extends AbstractResponse
Response
class represents a Response XML document.
The schema of Response is defined as the following:Modifier | Constructor and Description |
---|---|
protected |
Response()
default constructor
|
|
Response(Element root)
Constructor.
|
|
Response(String responseID,
Status status,
List contents)
This constructor shall only be used at the server side to construct
a Response object.
|
|
Response(String responseID,
Status status,
String recipient,
List contents)
This constructor shall only be used at the server side to construct
a Response object.
|
|
Response(String responseID,
String inResponseTo,
Status status,
List contents)
This constructor shall only be used at the server side to construct
a Response object.
|
|
Response(String responseID,
String inResponseTo,
Status status,
String recipient,
List contents)
This constructor shall only be used at the server side to construct
a Response object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addAssertion(Assertion assertion)
Add an assertion to the Response.
|
List |
getAssertion()
This method returns the set of Assertions that is the content of
the response.
|
Status |
getStatus()
Gets the Status of the Response.
|
boolean |
isSignatureValid()
Return whether the signature on the object is valid or not.
|
static Response |
parseXML(InputStream is)
Returns Response object based on the XML document received from server.
|
static Response |
parseXML(String xml)
Returns Response object based on the XML document received from server.
|
boolean |
setSignature(Element elem)
Set the signature for the Response.
|
boolean |
setStatus(Status status)
Set the Status of the Response.
|
void |
signXML()
Method that signs the Response.
|
String |
toString()
This method translates the response to an XML document String based on
the Response schema described above.
|
String |
toString(boolean includeNS,
boolean declareNS)
Creates a String representation of the
<samlp:Response> element. |
String |
toString(boolean includeNS,
boolean declareNS,
boolean includeHeader)
Creates a String representation of the
<samlp:Response> element. |
getInResponseTo, getIssueInstant, getMajorVersion, getMinorVersion, getRecipient, getResponseID, getSignature, isSigned, setInResponseTo, setIssueInstant, setMajorVersion, setMinorVersion, setRecipient, setResponseID
protected Response()
public Response(String responseID, String inResponseTo, Status status, List contents) throws SAMLException
ResponseID
,
MajorVersion
, etc. to form a complete Response object.responseID
- If it's null, the constructor will create one.inResponseTo
- the RequestID
that this response is
corresponding. It could be null or empty string "".status
- The status of the response.contents
- A List of Assertions that are the content of the
Response. It could be null when there is no Assertion.SAMLException
- if error occurs.public Response(String responseID, String inResponseTo, Status status, String recipient, List contents) throws SAMLException
ResponseID
,
MajorVersion
, etc. to form a complete Response object.responseID
- If it's null, the constructor will create one.inResponseTo
- the RequestID
that this response is
corresponding. It could be null or empty string "".status
- The status of the response.recipient
- The intended recipient of the response. It could be
null or empty string since it's optional.contents
- A List of Assertions that are the content of the
Response. It could be null when there is no Assertion.SAMLException
- if error occurs.public Response(String responseID, Status status, String recipient, List contents) throws SAMLException
ResponseID
,
MajorVersion
, etc. to form a complete Response object.responseID
- If it's null, the constructor will create one.status
- The status of the response.recipient
- The intended recipient of the response. It could be
null or empty string since it's optional.contents
- A List of Assertions that are the content of the
Response. It could be null when there is no Assertion.SAMLException
- if error occurs.public Response(String responseID, Status status, List contents) throws SAMLException
ResponseID
,
MajorVersion
, etc. to form a complete Response object.responseID
- If it's null, the constructor will create one.status
- The status of the response.contents
- A List of Assertions that are the content of the
Response. It could be null when there is no Assertion.SAMLException
- if error occurs.public Response(Element root) throws SAMLException
root
- Response
elementSAMLException
- if error occurs.public boolean isSignatureValid()
isSignatureValid
in class AbstractResponse
public void signXML() throws SAMLException
signXML
in class AbstractResponse
SAMLException
- if could not sign the Response.public static Response parseXML(String xml) throws SAMLException
xml
- The Response XML document String.
NOTE: this is a complete SAML response XML string with
ResponseID
, MajorVersion
, etc.SAMLException
- if XML parsing failedpublic static Response parseXML(InputStream is) throws SAMLException
is
- The Response XML InputStream
.
NOTE: The InputStream
contains a complete
SAML response with
ResponseID
, MajorVersion
, etc.SAMLException
- if XML parsing failedpublic List getAssertion()
public boolean addAssertion(Assertion assertion)
assertion
- The assertion to be added.public Status getStatus()
public boolean setStatus(Status status)
status
- The Status of the Response to be set.public boolean setSignature(Element elem)
setSignature
in class AbstractResponse
elem
- ds:Signature elementpublic String toString()
public String toString(boolean includeNS, boolean declareNS)
<samlp:Response>
element.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.public String toString(boolean includeNS, boolean declareNS, boolean includeHeader)
<samlp:Response>
element.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.Copyright © 2010-2018, ForgeRock All Rights Reserved.