/**
   * Signs Federation termination request before sending it to the remote provider.
   *
   * @param msg <code>SOAPMessage</code> which includes termination request to be sent to remote
   *     provider
   * @param idAttrName name of the id attribute to be signed
   * @param id the value of the id attributer to be signed
   * @return signed termination request in <code>SOAPMessage</code>
   * @exception SAMLException if an error occurred during signing
   */
  protected SOAPMessage signTerminationRequest(SOAPMessage msg, String idAttrName, String id)
      throws SAMLException {
    FSUtils.debug.message("FSSPFedTerminationHandler.signTerminationRequest: Called");
    String certAlias =
        IDFFMetaUtils.getFirstAttributeValueFromConfig(
            hostedConfig, IFSConstants.SIGNING_CERT_ALIAS);
    if (certAlias == null || certAlias.length() == 0) {
      if (FSUtils.debug.messageEnabled()) {
        FSUtils.debug.message(
            "FSSPFedTerminationHandler.signTerminationRequest: couldn't"
                + "obtain this site's cert alias.");
      }
      throw new SAMLResponderException(FSUtils.bundle.getString(IFSConstants.NO_CERT_ALIAS));
    }
    if (FSUtils.debug.messageEnabled()) {
      FSUtils.debug.message(
          "FSSPFedTerminationHandler.signTerminationRequest: Provider's "
              + "certAlias is found: "
              + certAlias);
    }
    XMLSignatureManager manager = XMLSignatureManager.getInstance();
    Document doc = (Document) FSServiceUtils.createSOAPDOM(msg);
    String xpath = "//*[local-name()=\'ProviderID\']";

    manager.signXML(
        doc,
        certAlias,
        SystemConfigurationUtil.getProperty(SAMLConstants.XMLSIG_ALGORITHM),
        idAttrName,
        id,
        false,
        xpath);
    return FSServiceUtils.convertDOMToSOAP(doc);
  }