/**
* 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: FSNameIdentifierMappingResponse.java,v 1.2 2008/06/25 05:46:44 qcheng Exp $
* Portions Copyrighted 2014 ForgeRock AS
*/
/**
* The class <code>FSNameIdentifierMappingResponse</code> is used to
* create , parse the <code>NameIdentifierMappingResponse</code>.
*
* @supported.all.api
* @deprecated since 12.0.0
*/
/**
* Constructor to create <code>FSNameIdentifierMappingResponse</code> object.
*
* @param providerID the value of <code>ProviderID</code> attribute.
* @param inResponseTo the value of <code>InResponseTo</code> attribute.
* @param status the <code>Status</code> object.
* @param nameIdentifier the resulting mapped identifier,
* <code>NameIdentifier</code>, for the desired identity federation.
* @throws FSMsgException on an error.
*/
this.providerID = providerID;
this.inResponseTo = inResponseTo;
this.nameIdentifier = nameIdentifier;
setIssueInstant(new Date());
}
/**
* Constructor to create <code>FSNameIdentifierMappingResponse</code> object.
* This object is created from the Document Element.
*
* @param root the <code>NameIdentifierMappingResponse</code> Document
* Element
* @throws FSMsgException if there is an error creating the object.
*/
throws FSMsgException {
"FSNameIdentifierMappingResponse: null element input");
}
"FSNameIdentifierMappingRequest: wrong input");
}
// get IssueInstant
"missing IssueInstant");
} else {
try {
} catch (Exception e) {
"could not parse IssueInstant.", e);
}
}
// get ResponseID
"response doesn't have ResponseID");
}
// get InResponseTo
if (inResponseTo == null) {
"response doesn't have InResponseTo");
}
// get and check versions
// get ProviderID, Status & NameIdentifier
for (int i = 0; i < length; i++) {
try {
} catch (SAMLException se) {
" unable to initialize Status", se);
}
try {
} catch (SAMLException samle) {
" unable to initialize NameIdentifier", samle);
throw new FSMsgException("nameIdentifierCreateError",
}
}
}
}
// get signature
root,
if (signsSize == 1) {
signed = true;
} else if (signsSize != 0) {
"included more than one Signature element.");
}
}
/**
* Creates <code>FSNameIdentifierMappingResponse</code> object.
* This object is created by parsing the <code>XML</code> string.
*
* @param xml the <code>XML</code> string to be parse.
* @return the <code>FSNameIdentifierMappingResponse</code> object.
* @throws FSMsgException if there is an error in parsing the
* <code>XML</code> string.
*/
throws FSMsgException {
"error while parsing input xml string");
}
return new FSNameIdentifierMappingResponse(root);
}
/**
* Returns the value of <code>ProviderID</code> attribute.
*
* @return the value of <code>ProviderID</code> attribute.
*/
return providerID;
}
/**
* Returns the <code>Status</code>.
*
* @return the <code>Status</code>.
*/
return status;
}
/**
* Returns the <code>NameIdentifier</code> object. This is the resulting
* mapped name identifier for the desired identity federation.
*
* @return <code>NameIdentifier</code> object, the resulting mapped name
* identifier for the desired identity federation
*/
return nameIdentifier;
}
/**
* Sets the <code>MajorVersion</code> by parsing the version string.
*
* @param version a String representing the <code>MajorVersion</code> to
* be set.
* @throws FSMsgException on error.
*/
try {
} catch (NumberFormatException e) {
"parseMajorVersion:invalid MajorVersion:" + version, e);
}
}
"parseMajorVersion: MajorVersion is too high");
}
} else {
"parseMajorVersion: MajorVersion is too low");
}
}
}
}
/**
* Sets the <code>MinorVersion</code> by parsing the version string.
*
* @param minorVer a String representing the <code>MinorVersion</code> to
* be set.
* @throws FSMsgException when the version mismatchs.
*/
try {
} catch (NumberFormatException e) {
"parseMinorVersion:invalid MinorVersion:" + version, e);
}
}
"parseMinorVersion: MinorVersion is too high");
}
"parseMinorVersion: MinorVersion is too low");
}
}
}
/**
* Signs the XML document representing
* <code>NameIdentifierMappingResponse</code> using the certificate
* indicated by the property "com.sun.identity.saml.xmlsig.certalias"
* in AMConfig.properties file.
*
* @throws SAMLException if there is an error signing
* the <code>XML</code> string.
*/
}
/**
* Signs the <code>XML</code> document representing
* <code>NameIdentifierMappingResponse</code> using the specified
* certificate.
*
* the XML document
* @throws SAMLException if there is an error signing
* the <code>XML</code> string or if the message is already
* signed.
*/
if (signed) {
+ " the response is already signed.");
}
"alreadySigned",null);
}
+ " null certAlias");
}
"cannotFindCertAlias",null);
}
try {
this.getResponseID(), false);
signed = true;
} catch (Exception e){
"unable to sign", e);
throw new SAMLResponderException(
}
}
/**
* Returns the string representation of this object.
*
* @return An XML String representing the object.
* @throws FSMsgException on error.
*/
return toXMLString(true, true);
}
/**
* Returns a String representation of this object.
*
* @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 {
}
/**
* Returns a String representation of this object.
*
* @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.
* @param includeHeader Determines whether the output include the xml
* declaration header.
* @return a string containing the valid XML for this element
* @throws FSMsgException if there is an error converting
* this object ot a string.
*/
boolean includeHeader) throws FSMsgException {
if (includeNS) {
}
if (declareNS) {
}
try {
} catch (Exception e) {
" could not convert issueInstant to String.", e);
}
// construct xml response
if (includeHeader) {
}
if (signed) {
if (signatureString != null) {
}
}
if (nameIdentifier != null) {
}
}
}