/**
* 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: FSNameIdentifierMappingRequest.java,v 1.2 2008/06/25 05:46:44 qcheng Exp $
* Portions Copyrighted 2014 ForgeRock AS
*/
/**
* The class <code>FSNameIdentifierMappingRequest</code> is used to
* create or parse <code>NameIdentifierMappingRequest<code>.
*
* @supported.all.api
* @deprecated since 12.0.0
*/
/**
* Constructor to create <code> FSNameIdentifierMappingRequest<code>.
*
* @param providerID the requesting provider's ID
* @param nameIdentifier the <code>NameIdentifier</code> qualified by the
* requesting service provider
* @param targetNamespace the provider ID of the other service provider
* which the requesting service provider would
* subsequently communicate with
* @throws FSMsgException if there is an error creating the object.
*/
throws FSMsgException {
this.providerID = providerID;
this.nameIdentifier = nameIdentifier;
this.targetNamespace = targetNamespace;
setIssueInstant(new Date());
}
/**
* Constructor to create <code> FSNameIdentifierMappingRequest<code> from
* the Document Element.
*
* @param root the <code>NameIdentifierMappingRequest</code> Document
* element.
* @throws FSMsgException if there is an error.
*/
"FSNameIdentifierMappingRequest: null element input.");
}
"FSNameIdentifierMappingRequest: wrong input");
}
// get IssueInstant
"missing IssueInstant");
} else {
try {
} catch (Exception e) {
"could not parse IssueInstant.", e);
}
}
// get RequestID
// get and check versions
// get ProviderID, NameIdentifier & TargetNamespace
for (int i = 0; i < length; i++) {
try {
} catch (SAMLException samle) {
"unable to initialize NameIdentifier", samle);
throw new FSMsgException(
}
}
}
}
// get signature
root,
if (signsSize == 1) {
signed = true;
} else if (signsSize != 0) {
"included more than one Signature element.");
}
}
/**
* Returns <code>FSNameIdentifierMappingRequest</code> object. This
* object is created by parsing the <code>XML</code> string.
*
* @param xml <code>XML</code> String
* @return the <code>FSNameIdentifierMappingRequest</code> object.
* @throws FSMsgException if there is an error creating this object.
*/
throws FSMsgException {
"error while parsing input xml string");
}
return new FSNameIdentifierMappingRequest(root);
}
/**
* Returns the <code>ProviderID</code> attribute. This
* is the requesting Service Providers's identifier.
*
* @return the <code>ProviderID</code> attribute.
*/
return providerID;
}
/**
* Returns the <code>NameIdentifier</code> object qualified by the
* requesting service provider .
*
* @return the <code>NameIdentifier</code> object qualified by the
* requesting service provider .
*/
return nameIdentifier;
}
/**
* Returns the value of <code>TargetNamespace</code> attribute.
*
* @return the value of <code>TargetNamespace</code> attribute.
*/
return targetNamespace;
}
/**
* Sets the <code>MajorVersion</code> by parsing the version string.
*
* @param majorVer a String representing the <code>MajorVersion</code> to
* be set.
* @throws FSMsgException when the version mismatches.
*/
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 mismatches.
*/
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>NameIdentifierMappingRequest</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 XML document.
*/
}
/**
* Signs the XML document representing
* <code>NameIdentifierMappingRequest</code> using the specified
* certificate.
*
* @param certAlias the alias (name) of the certificate used for signing
* the XML document
* @throws SAMLException it there is an error.
*/
if (signed) {
+ "the request is already signed.");
}
"alreadySigned",null);
}
+ "null certAlias");
}
"cannotFindCertAlias",null);
}
try {
this.getRequestID(), false);
signed = true;
} catch (Exception e){
"unable to sign", e);
"signFailed",null);
}
}
/**
* Returns the string representation of this object.
* This method translates the response to an XML document string.
*
* @return An XML String representing the response. NOTE: this is a
* complete SAML response xml string with ResponseID,
* MajorVersion, etc.
*/
return toXMLString(true, true);
}
/**
* Returns the string representation of this object.
*
* @return An XML String representing the response.
* @throws FSMsgException if there is an error converting
* this object ot a string.
*/
throws FSMsgException {
}
/**
* Returns a String representation of the <samlp:Response> element.
*
* @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 request
if (includeHeader) {
}
if (signed) {
if (signatureString != null) {
}
}
if (nameIdentifier != null) {
}
}
}