/**
   * Returns the <code>NameIDInfoKey</code> key value pair that can be used for searching the user.
   *
   * @param nameID <code>NameID</code> object.
   * @param hostEntityID hosted <code>EntityID</code>.
   * @param remoteEntityID remote <code>EntityID</code>.
   * @exception <code>WSFederationException</code> if any failure.
   */
  protected Map getSearchParameters(
      NameIdentifier nameID, String realm, String hostEntityID, String remoteEntityID)
      throws WSFederationException {

    if (nameID == null) {
      throw new WSFederationException(bundle.getString("nullNameID"));
    }

    NameIDInfoKey infoKey = null;
    try {
      infoKey = new NameIDInfoKey(nameID.getName(), hostEntityID, remoteEntityID);
    } catch (SAML2Exception se) {
      throw new WSFederationException(se);
    }

    HashSet set = new HashSet();
    set.add(infoKey.toValueString());

    Map keyMap = new HashMap();
    keyMap.put(AccountUtils.getNameIDInfoKeyAttribute(), set);

    if (debug.messageEnabled()) {
      debug.message("DefaultAccountMapper.getNameIDKeyMap: " + keyMap);
    }
    return keyMap;
  }
  /**
   * Updates the user account information. After sucessful operation, the federation status
   * corresponding to the user with the remote provider is set to inactive.
   *
   * @param ni <code>NameIdentifier</code> object corresponding to a user
   * @return boolean containing the status of the update operation
   */
  protected boolean updateAccountInformation(NameIdentifier ni) {
    try {
      FSUtils.debug.message("FSFedTerminationHandler::updateAccountInformation: start");
      String searchDomain = remoteEntityId;
      // get name identifier to remove it from federation info key
      String nameId = null;
      String nameQualifier = null;
      if (ni != null) {
        nameQualifier = ni.getNameQualifier();
        if (nameQualifier != null
            && (nameQualifier.length() != 0)
            && !nameQualifier.equals(remoteEntityId)) {
          searchDomain = nameQualifier;
        }
        nameId = ni.getName();
      }
      if (nameId == null && acctInfo != null) {
        FSUtils.debug.message("FSAccountManager: getnameId in accInfo");
        NameIdentifier temp = acctInfo.getLocalNameIdentifier();
        if (temp != null) {
          nameId = temp.getName();
          nameQualifier = temp.getNameQualifier();
        } else {
          temp = acctInfo.getRemoteNameIdentifier();
          if (temp != null) {
            nameId = temp.getName();
            nameQualifier = temp.getNameQualifier();
          }
        }
      }
      FSAccountFedInfoKey fedInfoKey = new FSAccountFedInfoKey(nameQualifier, nameId);
      managerInst.removeAccountFedInfo(userID, fedInfoKey, searchDomain);

      if (FSUtils.debug.messageEnabled()) {
        FSUtils.debug.message(
            "FSFedTerminationHandler:: "
                + "updateAccountInformation deactivate successfully completed");
      }
    } catch (FSAccountMgmtException e) {
      FSUtils.debug.error(
          "FSFedTerminationHandler::updateAccountInformation "
              + FSUtils.bundle.getString(IFSConstants.TERMINATION_LOCAL_FAILED));
      String[] data = {userID};
      LogUtil.error(Level.INFO, LogUtil.TERMINATION_FAILED, data, ssoToken);
      return false;
    }
    // Clean SessionMap off the partner to be done here.
    if (FSUtils.debug.messageEnabled()) {
      FSUtils.debug.message("Cleaning Session manager for user : " + userID);
      FSUtils.debug.message("Cleaning Session manager for remote provider: " + remoteEntityId);
      FSUtils.debug.message("Cleaning Session manager for hosted provider: " + hostedEntityId);
    }
    FSLogoutUtil.cleanSessionMapPartnerList(userID, remoteEntityId, metaAlias, null);
    return true;
  }