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
}