Package tigase.xmpp

Examples of tigase.xmpp.Authorization


            log.warning("User connection does not exist for the request to complete the user transfer: " + packet.toString());
            return;
          }
          String token = (String)conn.getSessionData(TOKEN);
          String xmpp_sessionId = conn.getSessionId();
          Authorization auth_res = null;
          try {
            auth_res = conn.loginToken(xmpp_sessionId, token);
          } catch (Exception e) {
            log.log(Level.WARNING, "Token authentication unsuccessful.", e);
            auth_res = Authorization.NOT_AUTHORIZED;
View Full Code Here


//       }

      if ((id.equals(session.getDomain())
          || id.equals(session.getUserId()))
        && packet.getFrom().equals(session.getConnectionId())) {
        Authorization result = Authorization.NOT_AUTHORIZED;
        Element request = packet.getElement();
        StanzaType type = packet.getType();
        switch (type) {
        case set:
          // Is it registration cancel request?
          Element elem = request.findChild("/iq/query/remove");
          if (elem != null) {
            // Yes this is registration cancel request
            // According to JEP-0077 there must not be any
            // more subelemets apart from <remove/>
            elem = request.findChild("/iq/query");
            if (elem.getChildren().size() > 1) {
              result = Authorization.BAD_REQUEST;
            } else {
              try {
                result = session.unregister(packet.getElemFrom());
                results.offer(packet.okResult((String)null, 0));
                results.offer(Command.CLOSE.getPacket(session.getDomain(),
                    session.getConnectionId(), StanzaType.set,
                    session.nextStanzaId()));

              } catch (NotAuthorizedException e) {
                results.offer(Authorization.NOT_AUTHORIZED.getResponseMessage(packet,
                    "You must authorize session first.", true));
              } // end of try-catch
            }
          } else {
            // No, so assuming this is registration of new
            // user or change registration details for existing user
            String user_name = request.getChildCData("/iq/query/username");
            String password = request.getChildCData("/iq/query/password");
            String email = request.getChildCData("/iq/query/email");
            result = session.register(user_name, password, email);
            if (result == Authorization.AUTHORIZED) {
              results.offer(result.getResponseMessage(packet, null, false));
            } else {
              results.offer(result.getResponseMessage(packet,
                  "Unsuccessful registration attempt", true));
            }
          }
          break;
        case get:
View Full Code Here

      String password = request.getChildCData("/iq/query/password");
      String digest = request.getChildCData("/iq/query/digest");
      //String user_pass = null;
      String auth_mod = null;
      try {
        Authorization result = null;
        if (password != null) {
//           user_pass = password;
//           result = session.loginPlain(user_name, user_pass);
          result = session.loginPlain(user_name, password);
        } // end of if (password != null)
View Full Code Here

      session.putSessionData(XMLNS+"-authProps", authProps);
    } // end of if (authProps == null)
    //    String user = (String)authProps.get(UserAuthRepository.USER_ID_KEY);
    authProps.put(UserAuthRepository.DATA_KEY, request.getCData());
    try {
      Authorization result = session.loginOther(authProps);
      String challenge_data =
        (String)authProps.get(UserAuthRepository.RESULT_KEY);
      if (result == Authorization.AUTHORIZED) {
        results.offer(packet.swapFromTo(createReply(ElementType.success,
              challenge_data)));
View Full Code Here

    } // end of if (waiting != null)
  }


  private void processStreamError(Packet packet, XMPPIOService serv) {
    Authorization author = Authorization.RECIPIENT_UNAVAILABLE;
    if (packet.getElement().getChild("host-unknown") != null) {
      author = Authorization.REMOTE_SERVER_NOT_FOUND;
    }
    String cid = getConnectionId(serv);
    bouncePacketsBack(author, cid);
View Full Code Here

    }
  }


  private void processStreamError(Packet packet, XMPPIOService serv) {
    Authorization author = Authorization.RECIPIENT_UNAVAILABLE;
    if (packet.getElement().getChild("host-unknown") != null) {
      author = Authorization.REMOTE_SERVER_NOT_FOUND;
    }
    String cid = getConnectionId(serv);
    bouncePacketsBack(author, cid);
View Full Code Here

TOP

Related Classes of tigase.xmpp.Authorization

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.