Interface PasswordEncoder


public interface PasswordEncoder
A password encoder API.

Modeled after the Spring Security PasswordEncoder API.

Since:
1.36
Version:
1.0
Author:
matt
  • Method Summary

    Modifier and Type
    Method
    Description
    encode(CharSequence rawPassword)
    Encode a raw password.
    boolean
    Return true if a password is already encrypted or not.
    boolean
    matches(CharSequence rawPassword, String encodedPassword)
    Verify the encoded password obtained from storage matches the submitted raw password after it too is encoded.
  • Method Details

    • isPasswordEncrypted

      boolean isPasswordEncrypted(CharSequence password)
      Return true if a password is already encrypted or not.

      This assumes the password has been encoded in such a way that it can be recognized as an ecrypted password, for example with a {SSHA} prefix.

      Parameters:
      password - the password
      Returns:
      true if the password appears to be in an encrypted form supported by this encoder
    • encode

      String encode(CharSequence rawPassword)
      Encode a raw password.
      Parameters:
      rawPassword - the password
      Returns:
      the encrypted password string
    • matches

      boolean matches(CharSequence rawPassword, String encodedPassword)
      Verify the encoded password obtained from storage matches the submitted raw password after it too is encoded. Returns true if the passwords match, false if they do not. The stored password itself is never decoded.
      Parameters:
      rawPassword - the raw password to encode and match
      encodedPassword - the encoded password from storage to compare with
      Returns:
      true if the raw password, after encoding, matches the encoded password from storage