/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: FSResponse.java,v 1.2 2008/06/25 05:46:45 qcheng Exp $
* Portions Copyrighted 2014 ForgeRock AS
*/
/**
* This class contains methods for creating a Liberty <code>Response</code>.
*
* @supported.all.api
* @deprecated since 12.0.0
*/
/**
* Returns the value of <code>id</code> attribute.
*
* @return the value of <code>id</code> attribute.
* @see #setID(String)
*/
return id;
}
/**
* Sets the value of <code>id</code> attribute.
*
* @param id the value of <code>id</code> attribute.
* @see #getID()
*/
}
/**
* Returns the signed <code>XML</code> string.
*
* @return the signed <code>XML</code> string.
*/
return signatureString;
}
/**
* Returns the <code>MinorVersion</code>.
*
* @return the <code>MinorVersion</code>.
* @see #setMinorVersion(int)
*/
public int getMinorVersion() {
return minorVersion;
}
/**
* Sets the <code>MinorVersion</code>.
*
* @param version the <code>MinorVersion</code>.
* @see #getMinorVersion()
*/
}
/**
* Constructor creates <code>FSResponse</code> object.
*
* @param responseID value of <code>ResponseId</code> attribute.
* @param inResponseTo value of <code>inResponseTo</code> attribute.
* @param status the <code>Status</code> object.
* @param contents list containing response elements.
* @throws SAMLException it there is an error creating this object.
* @throws FSMsgException it there is an error creating this object.
*/
}
) throws SAMLException, FSMsgException {
// parse the xml string
+ "while parsing input xml string");
}
return new FSResponse(root);
}
/**
* Constructor creates <code>FSResponse</code> object form
* a Document Element.
*
* @param root the Document Element object.
* @throws SAMLException if there is an error creating this object.
* @throws FSMsgException if there is an error creating this object.
*/
+ "Input paramenter (root) is null");
}
+ "Root element name is not Response");
}
+ "Response doesn't have ResponseID attribute");
}
}
if (inResponseTo == null) {
+ "Response doesn't have InResponseTo attribute");
}
}
// Attribute IssueInstant
} else {
try {
} catch (ParseException e) {
+ "parse IssueInstant:", e);
}
}
}
for (int i = 0; i < length; i++) {
"FSResponse(Element): included more"
+ " than one <Status>");
}
}
assertions = new ArrayList();
}
}else {
"FSResponse(Element): included wrong "
+ "element: " + childName);
}
}
} // end if childName != null
} // end for loop
"FSResponse(Element): missing element <Status>.");
}
//check for signature
if (signsSize == 1) {
signed = true;
} else if (signsSize != 0) {
+ " one Signature element.");
}
}
//end check for signature
}
/**
* Sets the <code>MajorVersion</code> by parsing the version string.
*
* @param majorVer a String representing the <code>MajorVersion</code> to
* be set.
* @throws SAMLException on error.
* @throws FSMsgException if there is an error parsing the version string.
*/
throws SAMLException, FSMsgException {
try {
} catch (NumberFormatException e) {
+ "MajorVersion", e);
}
}
+ " the Response is too high.");
}
"responseVersionTooHigh",null);
} else {
+ " the Response is too low.");
}
"responseVersionTooLow",null);
}
}
}
/**
* Sets the <code>MinorVersion</code> by parsing the version string.
*
* @param minorVer a String representing the <code>MinorVersion</code> to
* be set.
* @throws SAMLException when the version mismatchs.
* @throws FSMsgException if there is an error
* parsing the version string.
*/
throws SAMLException, FSMsgException {
try {
} catch (NumberFormatException e) {
+ "MinorVersion", e);
}
}
+ " the Response is too high.");
"responseVersionTooHigh",null);
} else if (minorVersion <
+ " the Response is too low.");
"responseVersionTooLow",null);
}
}
/**
* Returns a String representation of the Logout Response.
*
* @return a string containing the valid XML for this element
* @throws FSMsgException if there is an error converting
* this object to a string.
*/
return this.toXMLString(true, true);
}
/**
* Returns a String representation of the Logout Response.
*
* @param includeNS : Determines whether or not the namespace qualifier
* is prepended to the Element when converted
* @param declareNS : Determines whether or not the namespace is declared
* within the Element.
* @return a string containing the valid XML for this element
* @throws FSMsgException if there is an error converting
* this object ot a string.
*/
throws FSMsgException {
}
boolean includeHeader) throws FSMsgException {
if (includeHeader) {
}
if (includeNS) {
}
if (declareNS) {
} else {
}
}
append("\" ");
}
}
append("\" ").
append("\"");
}
}
if (signed) {
if (signatureString != null) {
}
}
while (j.hasNext()) {
toXMLString(true,declareNS));
}
}
}
/**
* Returns <code>FSResponse</code> object. The object
* is created by parsing an Base64 encoded response string.
*
* @param encodedRes the encoded response string
* @throws FSMsgException if there is an error creating
* <code>FSResponse</code> object.
* @throws FSMsgException if there is an error creating
* <code>FSResponse</code> object.
*/
if (encodedRes != null) {
+ "Decoded AuthnResponse message: "
+ decodedAuthnRes);
}
return parseResponseXML(decodedAuthnRes);
} else{
+ "null String passed in as argument.");
}
}
}
/**
* Returns a Base64 Encoded String.
*
* @return a Base64 Encoded String.
* @throws FSMsgException if there is an error encoding the string.
*/
if (responseID == null) {
+ "couldn't generate ResponseID.");
}
}
}
/**
* Signs the Response.
*
* @param certAlias the Certificate Alias.
* @throws XMLSignatureException if <code>FSAuthnRequest</code>
* cannot be signed.
*/
if (signed) {
+ "already signed.");
}
"alreadySigned",null);
}
"cannotFindCertAlias",null);
}
try {
this.toXMLString(true, true),
this.id, false);
} else if (minorVersion ==
this.toXMLString(true, true),
this.getResponseID(), false);
} else {
}
}
signed = true;
xmlString = this.toXMLString(true, true);
} catch(Exception e){
"signFailed",null);
}
}
/**
* Unsupported operation.
*/
"unsupportedOperation",null);
}
}