/**
   * Initialize -- load password files etc. Password file format is name:authentication
   * domain:password
   *
   * @param pwFileName is the password file name.
   * @param Exception is thrown when the password file is bad.
   */
  public void initialize(String pwFileName) {
    try {
      XMLAuthenticationParser parser = new XMLAuthenticationParser(pwFileName);

      String def = parser.getRealm();
      if (def != null) DEFAULT_REALM = def;
      ProxyDebug.println(
          "DEBUG, DigestAuthenticationMethod, initialize()," + " the realm is:" + DEFAULT_REALM);
      Vector usersTagList = parser.getUsersTagList();
      if (usersTagList != null)
        for (int i = 0; i < usersTagList.size(); i++) {
          UserTag userTag = (UserTag) usersTagList.elementAt(i);
          String userName = userTag.getUserName();
          // String userRealm=userTag.getUserRealm();
          String userPassword = userTag.getUserPassword();
          if (userName != null) {

            if (userPassword == null) {
              ProxyDebug.println(
                  "DEBUG, DigestAuthenticationMethod, initialize(),"
                      + " the userPassword parameter does not exist for user: "******", we use the default: \""
                      + NULL_PASSWORD
                      + "\"");
              userPassword = NULL_PASSWORD;
            }
            passwordTable.put(userName + "@" + DEFAULT_REALM, userPassword);
          } else {
            ProxyDebug.println(
                "DEBUG, DigestAuthenticationMethod, initialize(),"
                    + " the userName parameter does not exist, we skip this entry!!");
          }
        }
      else
        ProxyDebug.println(
            "DEBUG, DigestAuthenticationMethod, initialize(),"
                + "Error during parsing the passwords file!");

    } catch (Exception e) {
      ProxyDebug.println("ERROR, DigestAuthenticationMethod, initialize()," + "exception raised:");
      e.printStackTrace();
    }
  }
コード例 #2
0
  public void sendSubscribeToAllPresentities(Vector buddies, boolean EXPIRED) {
    try {
      logger.debug(
          "logger, IMSubscribeProcessing, sendSubscribeToAllPresentities(),"
              + " we have to subscribe to our buddies: let's send a SUBSCRIBE for each ones.");
      for (int i = 0; i < buddies.size(); i++) {
        BuddyTag buddyTag = (BuddyTag) buddies.elementAt(i);

        String buddyURI = buddyTag.getURI();

        InstantMessagingGUI imGUI = imUA.getInstantMessagingGUI();
        ListenerInstantMessaging listenerIM = imGUI.getListenerInstantMessaging();
        String localURL = listenerIM.getLocalSipURL();
        sendSubscribe(localURL, buddyURI, EXPIRED);
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }