Package tigase.db

Examples of tigase.db.AuthorizationException


  public boolean plainAuth(final String user, final String password)
    throws UserNotFoundException, TigaseDBException, AuthorizationException {
    try {
      checkConnection();
      if (!isActive(user)) {
        throw new AuthorizationException("User account has been blocked.");
      } // end of if (!isActive(user))
      //      String enc_passwd = ls_digest(password);
      String db_password = getPassword(user);
      boolean login_ok = db_password.equals(password);
      if (login_ok) {
View Full Code Here


    final String id, final String alg)
    throws UserNotFoundException, TigaseDBException, AuthorizationException {
    try {
      checkConnection();
      if (!isActive(user)) {
        throw new AuthorizationException("User account has been blocked.");
      } // end of if (!isActive(user))
      final String db_password = getPassword(user);
      final String digest_db_pass =  Algorithms.hexDigest(id, db_password, alg);
      log.finest("Comparing passwords, given: " + digest
        + ", db: " + digest_db_pass);
      return digest.equals(digest_db_pass);
    } catch (NoSuchAlgorithmException e) {
      throw new AuthorizationException("No such algorithm.", e);
    } catch (SQLException e) {
      throw new TigaseDBException("Problem accessing repository.", e);
    } // end of catch
  }
View Full Code Here

        } // end of if (login_ok)
        return login_ok;
        //      } // end of if (mech.equals("PLAIN"))
      //throw new AuthorizationException("Mechanism is not supported: " + mech);
    } // end of if (proto.equals(PROTOCOL_VAL_SASL))
    throw new AuthorizationException("Protocol is not supported: " + proto);
  }
View Full Code Here

        return true;
      } else {
        return false;
      } // end of if (ss.isComplete()) else
    } catch (SaslException e) {
      throw new AuthorizationException("Sasl exception.", e);
    } // end of try-catch
  }
View Full Code Here

   */
  public boolean digestAuth(final String user, final String digest,
    final String id, final String alg)
    throws UserNotFoundException, TigaseDBException, AuthorizationException {
    if (userlogin_active) {
      throw new AuthorizationException("Not supported.");
    } else {
      final String db_password = getPassword(user);
      try {
        final String digest_db_pass =  Algorithms.hexDigest(id, db_password, alg);
        log.finest("Comparing passwords, given: " + digest
          + ", db: " + digest_db_pass);
        return digest.equals(digest_db_pass);
      } catch (NoSuchAlgorithmException e) {
        throw new AuthorizationException("No such algorithm.", e);
      } // end of try-catch
    }
  }
View Full Code Here

        return saslPlainAuth(props);
      } else {
        return saslAuth(props);
      }
    } // end of if (proto.equals(PROTOCOL_VAL_SASL))
    throw new AuthorizationException("Protocol is not supported.");
  }
View Full Code Here

        return true;
      } else {
        return false;
      } // end of if (ss.isComplete()) else
    } catch (SaslException e) {
      throw new AuthorizationException("Sasl exception.", e);
    } // end of try-catch
  }
View Full Code Here

  public boolean plainAuth(final String user, final String password)
    throws UserNotFoundException, TigaseDBException, AuthorizationException {
    try {
      checkConnection();
      if (!isActive(user)) {
        throw new AuthorizationException("User account has been blocked.");
      } // end of if (!isActive(user))
      String enc_passwd = Algorithms.hexDigest("", password, "MD5");
      String db_password = getPassword(user);
      boolean login_ok = db_password.equals(enc_passwd);
      if (login_ok) {
        updateLastLogin(user);
        updateOnlineStatus(user, 1);
      } // end of if (login_ok)
      return login_ok;
    } catch (NoSuchAlgorithmException e) {
      throw
        new AuthorizationException("Password encoding algorithm is not supported.",
          e);
    } catch (SQLException e) {
      throw new TigaseDBException("Problem accessing repository.", e);
    } // end of catch
  }
View Full Code Here

   * @exception AuthorizationException if an error occurs
   */
  public boolean digestAuth(final String user, final String digest,
    final String id, final String alg)
    throws UserNotFoundException, TigaseDBException, AuthorizationException {
    throw new AuthorizationException("Not supported.");
  }
View Full Code Here

          updateLastLogin(user);
          updateOnlineStatus(user, 1);
        } // end of if (login_ok)
        return login_ok;
      } // end of if (mech.equals("PLAIN"))
      throw new AuthorizationException("Mechanism is not supported: " + mech);
    } // end of if (proto.equals(PROTOCOL_VAL_SASL))
    throw new AuthorizationException("Protocol is not supported: " + proto);
  }
View Full Code Here

TOP

Related Classes of tigase.db.AuthorizationException

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.