Class PasswordVerifier

java.lang.Object
eu.webtoolkit.jwt.auth.PasswordVerifier
All Implemented Interfaces:
PasswordService.AbstractVerifier

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

    Constructors 
    Constructor Description
    PasswordVerifier()
    Constructor.
  • 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