Class PasswordVerifier

All Implemented Interfaces:

public class PasswordVerifier
extends java.lang.Object
implements PasswordService.AbstractVerifier
Password hash computation and verification class.

This class implements the logic for comparing passwords against password hashes, or computing a new password hash for a password.

One or more hash functions can be added, which allow you to introduce a new "preferred" hash function while maintaining support for verifying existing passwords hashes.

  • Constructor Summary

    Constructor Description
  • Method Summary

    Modifier and Type Method Description
    void addHashFunction​(HashFunction function)
    Adds a hash function.
    java.util.List<HashFunction> getHashFunctions()
    Returns the list of hash functions.
    PasswordHash hashPassword​(java.lang.CharSequence password)
    Computes the password hash for a clear text password.
    boolean needsUpdate​(PasswordHash hash)
    Returns whether a password hash needs to be updated (recomputed).
    boolean verify​(java.lang.CharSequence password, PasswordHash hash)
    Verifies a password against a hash.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait