com.sun.identity.federation.message
Class FSAuthnResponse

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

public class FSAuthnResponse
extends Response

The class FSAuthnResponse creates and parses the Liberty Response. This class extends the SAML Response.


Field Summary
protected  String consentURI
           
protected  Element domElement
           
protected  String id
           
protected  int minorVersion
           
protected  String relayState
           
 
Fields inherited from class com.sun.identity.saml.protocol.Response
assertions, issuer, signatureString, status, xmlString
 
Fields inherited from class com.sun.identity.saml.protocol.AbstractResponse
inResponseTo, issueInstant, majorVersion, recipient, responseID, signature, signed, valid, validationDone
 
Constructor Summary
FSAuthnResponse(Element root)
          Constructor creates FSAuthnResponse object from Document Element.
FSAuthnResponse(String responseID, String inResponseTo, Status status, List contents, String relayState)
          Constructor to create FSAuthnResponse object.
 
Method Summary
 String getConsentURI()
          Returns the value of the consent attribute.
 Element getDOMElement()
          Returns the Document Element for this object.
 String getID()
          Returns the value of the id attribute.
 int getMinorVersion()
          Returns the value MinorVersion attribute.
 String getProviderId()
          Returns the ProviderID attribute value.
 String getRelayState()
          Returns the RelayState attribute in the Response.
 String getSignatureString()
          Returns the Signature string.
 String getSignedXMLString()
          Returns a signed XML Representation of this object.
static FSAuthnResponse parseAuthnResponseXML(String xml)
          Creates FSAuthnResponse object from XML Schema.
static FSAuthnResponse parseBASE64EncodedString(String encodedRes)
          Returns FSAutnResponse object by parsing a Base64 encoding XML string.
 void setConsentURI(String consent)
          Sets the value of the consent attribute.
 void setID(String id)
          Sets the value of the id attribute.
 void setMinorVersion(int version)
          Returns the value of MajorVersion attribute.
 void setProviderId(String provId)
          Sets the ProviderID attribute value.
 boolean setSignature(Element elem)
          Sets the Element signature.
 void signXML(String certAlias)
          Signs the Response.
 String toBASE64EncodedString()
          Returns a Base64 encoded string representing this object.
 String toXMLString()
          Returns the string representation of this object.
 String toXMLString(boolean includeNS, boolean declareNS)
          Returns a String representation of the <samlp:Response> element.
 String toXMLString(boolean includeNS, boolean declareNS, boolean includeHeader)
          Returns 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
 

Field Detail

relayState

protected String relayState

consentURI

protected String consentURI

minorVersion

protected int minorVersion

id

protected String id

domElement

protected Element domElement
Constructor Detail

FSAuthnResponse

public FSAuthnResponse(String responseID,
                       String inResponseTo,
                       Status status,
                       List contents,
                       String relayState)
                throws SAMLException,
                       FSMsgException
Constructor to create FSAuthnResponse object.

Parameters:
responseID - value of the ResponseID attribute.
inResponseTo - value of the inResponseTo attribute.
status - the Status object.
contents - List of Assertions in the response. It could be null when there are no Assertions.
relayState - value of the RelayState attribute.
Throws:
FSMsgException - on error.
SAMLException - on error.

FSAuthnResponse

public FSAuthnResponse(Element root)
                throws SAMLException,
                       FSMsgException
Constructor creates FSAuthnResponse object from Document Element.

Parameters:
root - the Document Element
Throws:
SAMLException - on error.
FSMsgException - on error.
Method Detail

parseAuthnResponseXML

public static FSAuthnResponse parseAuthnResponseXML(String xml)
                                             throws SAMLException,
                                                    FSMsgException
Creates FSAuthnResponse object from XML Schema.

Parameters:
xml - the XML Schema for this object.
Throws:
SAMLException - on error.
FSMsgException - on error.
SAMLException

getID

public String getID()
Returns the value of the id attribute.

Returns:
the value of id attribute.
See Also:
FSAuthnResponse.setID(String)

setID

public void setID(String id)
Sets the value of the id attribute.

Parameters:
id - the new value of id attribute.
See Also:
FSAuthnResponse.getID()

getProviderId

public String getProviderId()
Returns the ProviderID attribute value.

Returns:
value of the ProviderID attribute.
See Also:
FSAuthnResponse.setProviderId(String)

setProviderId

public void setProviderId(String provId)
Sets the ProviderID attribute value.

Parameters:
provId - new value of ProviderID attribute.
See Also:
FSAuthnResponse.getProviderId()

getSignedXMLString

public String getSignedXMLString()
Returns a signed XML Representation of this object.

Returns:
a signed XML Representation of this object.

getSignatureString

public String getSignatureString()
Returns the Signature string.

Returns:
the Signature string.

getMinorVersion

public int getMinorVersion()
Returns the value MinorVersion attribute.

Overrides:
getMinorVersion in class AbstractResponse
Returns:
the value MinorVersion attribute.
See Also:
FSAuthnResponse.setMinorVersion(int)

setMinorVersion

public void setMinorVersion(int version)
Returns the value of MajorVersion attribute.

Overrides:
setMinorVersion in class AbstractResponse
Parameters:
version - the value of MajorVersion attribute.
See Also:
FSAuthnResponse.getMinorVersion()

getConsentURI

public String getConsentURI()
Returns the value of the consent attribute.

Returns:
value of consent attribute.
See Also:
FSAuthnResponse.setConsentURI(String)

setConsentURI

public void setConsentURI(String consent)
Sets the value of the consent attribute.

Parameters:
consent - new value of consent attribute.
See Also:
FSAuthnResponse.getConsentURI()

getDOMElement

public Element getDOMElement()
Returns the Document Element for this object.

Returns:
the Document Element for this object.

getRelayState

public String getRelayState()
Returns the RelayState attribute in the Response.

Returns:
the RelayState attribute in the Response.

toXMLString

public String toXMLString()
                   throws FSMsgException
Returns the string representation of this object. 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

toXMLString

public String toXMLString(boolean includeNS,
                          boolean declareNS)
                   throws FSMsgException
Returns 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

toXMLString

public String toXMLString(boolean includeNS,
                          boolean declareNS,
                          boolean includeHeader)
                   throws FSMsgException
Returns 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

parseBASE64EncodedString

public static FSAuthnResponse parseBASE64EncodedString(String encodedRes)
                                                throws FSMsgException,
                                                       SAMLException
Returns FSAutnResponse object by parsing a Base64 encoding XML string.

Parameters:
encodedRes - the Base64 encoded string.
Returns:
FSAuthnResponse object.
Throws:
FSMsgException - if there is an error parsing the Base64 encoded string.
SAMLException - if there is an error creating the FSAuthnResponse object.

toBASE64EncodedString

public String toBASE64EncodedString()
                             throws FSMsgException
Returns a Base64 encoded string representing this object.

Returns:
a Base64 encoded string representing this object.
Throws:
FSMsgException - if there is an error creating a Base64 encoded string.

signXML

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

Parameters:
certAlias - the Certificate Alias
Throws:
SAMLException - if Response cannot be signed.

setSignature

public boolean setSignature(Element elem)
Sets the Element signature.

Overrides:
setSignature in class Response
Parameters:
elem - the Element object
Returns:
true if signature is set otherwise false