com.sun.identity.federation.message
Class FSResponse

java.lang.Object
  extended bycom.sun.identity.saml.protocol.AbstractResponse
      extended bycom.sun.identity.saml.protocol.Response
          extended bycom.sun.identity.federation.message.FSResponse

public class FSResponse
extends Response

This class FSResponse is used to construct or parse SSO/Federation Response using browser artifact profile.


Constructor Summary
FSResponse(org.w3c.dom.Element root)
          Constructor.
FSResponse(java.lang.String responseID, java.lang.String inResponseTo, Status status, java.util.List contents)
          This constructor shall only be used at the server side to construct a Response object.
 
Method Summary
 java.lang.String getID()
          Gets id attribute.
 int getMinorVersion()
          Gets minor version
 java.lang.String getSignatureString()
          Get the Signature Element as string
 java.lang.String getSignedXMLString()
          Get Signed XML String
static FSResponse parseBASE64EncodedString(java.lang.String encodedRes)
          Creates the response object based on the Base 64 encoded string.
static FSResponse parseResponseXML(java.lang.String xml)
          Returns Response object based on the XML document received from server.
 void setID(java.lang.String id)
          Sets id attribute.
 void setMinorVersion(int version)
          Sets minor version
 void signXML()
          Signs the Response.
 void signXML(java.lang.String certAlias)
          Signs the Response.
 java.lang.String toBASE64EncodedString()
          Gets the BASE64 encoded string of the response object.
 java.lang.String toXMLString()
          This method translates the response to an XML document String based on the Response schema described above.
 java.lang.String toXMLString(boolean includeNS, boolean declareNS)
          Creates a String representation of the response element.
 java.lang.String toXMLString(boolean includeNS, boolean declareNS, boolean includeHeader)
          Creates a String representation of the Response element.
 
Methods inherited from class com.sun.identity.saml.protocol.Response
addAssertion, getAssertion, getStatus, isSignatureValid, parseXML, parseXML, setSignature, setStatus, toString, toString, toString
 
Methods inherited from class com.sun.identity.saml.protocol.AbstractResponse
getInResponseTo, getIssueInstant, getMajorVersion, getRecipient, getResponseID, getSignature, isSigned, setInResponseTo, setIssueInstant, setMajorVersion, setRecipient, setResponseID
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FSResponse

public FSResponse(java.lang.String responseID,
                  java.lang.String inResponseTo,
                  Status status,
                  java.util.List contents)
           throws SAMLException
This constructor shall only be used at the server side to construct a Response object. NOTE: The content here is just the body for the Response. The constructor will add the unique ResponseID, MajorVersion, etc. to form a complete Response object.

Parameters:
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.
Throws:
SAMLException - if error occurs.

FSResponse

public FSResponse(org.w3c.dom.Element root)
           throws SAMLException,
                  FSMsgException
Constructor.

Parameters:
root - Response element
Throws:
FSMsgException - if parsing failed.
SAMLException - if unable to construct the Response object.
Method Detail

getID

public java.lang.String getID()
Gets id attribute. This is for ID-FF 1.1 only.

Returns:
id attribute.

setID

public void setID(java.lang.String id)
Sets id attribute. This is for ID-FF 1.1 only.

Parameters:
id - id to be set.

getSignedXMLString

public java.lang.String getSignedXMLString()
Get Signed XML String

Returns:
String signed XML String, return null if FSResponse is not signed.

getSignatureString

public java.lang.String getSignatureString()
Get the Signature Element as string

Returns:
String Signature, return null if FSResponse is not signed.

getMinorVersion

public int getMinorVersion()
Gets minor version

Overrides:
getMinorVersion in class AbstractResponse
Returns:
minor version

setMinorVersion

public void setMinorVersion(int version)
Sets minor version

Overrides:
setMinorVersion in class AbstractResponse
Parameters:
version - minor version to be set

parseResponseXML

public static FSResponse parseResponseXML(java.lang.String xml)
                                   throws SAMLException,
                                          FSMsgException
Returns Response object based on the XML document received from server. This method is used primarily at the client side. The schema of the XML document is describe above.

Parameters:
xml - The Response XML document String. NOTE: this is a complete SAML response XML string with ResponseID, MajorVersion, etc.
Returns:
FSResponse object based on the XML document received from server.
Throws:
FSMsgException - if unable to convert XML to DOM.
SAMLException - if unable to construct the response object.

toXMLString

public java.lang.String toXMLString()
                             throws FSMsgException
This method translates the response to an XML document String based on the Response schema described above.

Returns:
An XML String representing the response. NOTE: this is a complete SAML response XML string with ResponseID, MajorVersion, etc.
Throws:
FSMsgException - if unable to get the XML string.

toXMLString

public java.lang.String toXMLString(boolean includeNS,
                                    boolean declareNS)
                             throws FSMsgException
Creates a String representation of the response 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
Throws:
FSMsgException - if unable to get the XML string.

toXMLString

public java.lang.String toXMLString(boolean includeNS,
                                    boolean declareNS,
                                    boolean includeHeader)
                             throws FSMsgException
Creates a String representation of the Response 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
Throws:
FSMsgException - if unable to get the XML string.

parseBASE64EncodedString

public static FSResponse parseBASE64EncodedString(java.lang.String encodedRes)
                                           throws FSMsgException,
                                                  SAMLException
Creates the response object based on the Base 64 encoded string.

Parameters:
encodedRes - base 64 encoded response.
Returns:
FSResponse object
Throws:
FSMsgException - if unable to parse the encoded string
SAMLException - if unable to parse the encoded string

toBASE64EncodedString

public java.lang.String toBASE64EncodedString()
                                       throws FSMsgException
Gets the BASE64 encoded string of the response object.

Returns:
BASE64 encoded string of the response object.
Throws:
FSMsgException - if unable to get the encoded string.

signXML

public void signXML(java.lang.String certAlias)
             throws SAMLException
Signs the Response.

Parameters:
certAlias - certificate alias which will be used for signing,
Throws:
SAMLException - if could not sign the Response.

signXML

public void signXML()
             throws SAMLException
Signs the Response.

Overrides:
signXML in class Response
Throws:
SAMLException - if could not sign the Response.


Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.