com.sun.identity.federation.message
Class FSAuthnResponse

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

public class FSAuthnResponse
extends Response

This class FSAuthnResponse is used to create or parse an ID-FF authentication response using POST/LECP profile.


Constructor Summary
FSAuthnResponse(org.w3c.dom.Element root)
          Constructor.
FSAuthnResponse(java.lang.String responseID, java.lang.String inResponseTo, Status status, java.util.List contents, java.lang.String relayState)
          This constructor shall only be used at the server side to construct a Response object.
 
Method Summary
 java.lang.String getConsentURI()
          Gets consent URI
 org.w3c.dom.Element getDOMElement()
          Returns original DOM Element used to construct the FSAuthnResponse object.
 java.lang.String getID()
          Gets id attribute.
 int getMinorVersion()
          Gets minor version
 java.lang.String getProviderId()
          Gets provider ID for this response
 java.lang.String getRelayState()
          Gets the RelayState of the Response.
 java.lang.String getSignatureString()
          Get the Signature Element string
 java.lang.String getSignedXMLString()
          Get Signed XML String
static FSAuthnResponse parseAuthnResponseXML(java.lang.String xml)
          Creates the FSAuthnResponse from XML string
static FSAuthnResponse parseBASE64EncodedString(java.lang.String encodedRes)
          Creates the FSAuthnResponse from BASE64 encoded string
 void setConsentURI(java.lang.String consent)
          Sets consent URI
 void setID(java.lang.String id)
          Sets id attribute.
 void setMinorVersion(int version)
          Sets minor version
 void setProviderId(java.lang.String provId)
          Sets provider ID for this response
 boolean setSignature(org.w3c.dom.Element elem)
          Sets the Signature element
 void signXML(java.lang.String certAlias)
          Signs the FSAuthnResponse.
 java.lang.String toBASE64EncodedString()
          Gets the BASE64 encoded string representation of the 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 <samlp:Response> element.
 java.lang.String toXMLString(boolean includeNS, boolean declareNS, boolean includeHeader)
          Creates a String representation of the <samlp:Response> element.
 
Methods inherited from class com.sun.identity.saml.protocol.Response
addAssertion, getAssertion, getStatus, isSignatureValid, parseXML, parseXML, setStatus, signXML, 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

FSAuthnResponse

public FSAuthnResponse(java.lang.String responseID,
                       java.lang.String inResponseTo,
                       Status status,
                       java.util.List contents,
                       java.lang.String relayState)
                throws SAMLException
This constructor shall only be used at the server side to construct a 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.
relayState - relay state for the response
Throws:
SAMLException - if error occurs.

FSAuthnResponse

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

Parameters:
root - DOM Element representing the response object.
Throws:
SAMLException - if error occurs
FSMsgException - if error occurs
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.

getProviderId

public java.lang.String getProviderId()
Gets provider ID for this response

Returns:
provider id.

setProviderId

public void setProviderId(java.lang.String provId)
Sets provider ID for this response

Parameters:
provId - provider id to be set

getSignedXMLString

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

Returns:
String signed XML String, null if the FSAuthnResponse is not signed.

getSignatureString

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

Returns:
Signature string, null if the FSAuthnResponse 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

getConsentURI

public java.lang.String getConsentURI()
Gets consent URI

Returns:
consent URI

setConsentURI

public void setConsentURI(java.lang.String consent)
Sets consent URI

Parameters:
consent - consent URI to be set

getDOMElement

public org.w3c.dom.Element getDOMElement()
Returns original DOM Element used to construct the FSAuthnResponse object.

Returns:
original DOM Element, null if the object is not constructed from a DOM element.

parseAuthnResponseXML

public static FSAuthnResponse parseAuthnResponseXML(java.lang.String xml)
                                             throws SAMLException,
                                                    FSMsgException
Creates the FSAuthnResponse from XML string

Parameters:
xml - XML String representing the FSAuthnResponse object
Returns:
the FSAuthnResponse object
Throws:
FSMsgException - if unable to parse the XML string
SAMLException - if unable to parse the XML string

getRelayState

public java.lang.String getRelayState()
Gets the RelayState of the Response.

Returns:
The RelayState of the response.

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 <samlp: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 <samlp: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 FSAuthnResponse parseBASE64EncodedString(java.lang.String encodedRes)
                                                throws FSMsgException,
                                                       SAMLException
Creates the FSAuthnResponse from BASE64 encoded string

Parameters:
encodedRes - BASE64 encoded string representing the response
Returns:
the FSAuthnResponse object
Throws:
SAMLException - if unable to construct the object
FSMsgException - if unable to construct the object

toBASE64EncodedString

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

Returns:
BASE64 encoded string
Throws:
FSMsgException - if error occurs

signXML

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

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

setSignature

public boolean setSignature(org.w3c.dom.Element elem)
Sets the Signature element

Overrides:
setSignature in class Response
Parameters:
elem - Signature Element to be set.
Returns:
true if successful, false otherwise.


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