Interface PasswordService.AbstractVerifier

All Known Implementing Classes:
PasswordVerifier
Enclosing class:
PasswordService

public static interface PasswordService.AbstractVerifier
Abstract password hash computation and verification class.

This class defines the interface for verifying a passwords against password hashes, or computing a new password hash for a password.

See Also:
PasswordService.setVerifier(PasswordService.AbstractVerifier verifier)
  • Method Summary

    Modifier and Type Method Description
    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.
  • Method Details

    • needsUpdate

      boolean needsUpdate​(PasswordHash hash)
      Returns whether a password hash needs to be updated (recomputed).

      A hash may need to be updated if it has been computed with a cryptographic method that is being disfavoured.

    • hashPassword

      PasswordHash hashPassword​(java.lang.CharSequence password)
      Computes the password hash for a clear text password.

      This must return a hash that can later be used to verify the user's password, but which avoids compromising the user's password in case of loss.

    • verify

      boolean verify​(java.lang.CharSequence password, PasswordHash hash)
      Verifies a password against a hash.

      This returns whether the given password matches with the user's credentials stored in the hash.