Interface Password.Encoder<A extends Password<A,B>,B extends Password.Encoder<A,B>>

Type Parameters:
A - the password type
B - the password encoder type
All Known Implementing Classes:
Argon2Password.Encoder, BCryptPassword.Encoder, DigestPassword.Encoder, MessageDigestPassword.Encoder, PBKDF2Password.Encoder, RawPassword.Encoder, SCryptPassword.Encoder
Enclosing interface:
Password<A extends Password<A,B>,B extends Password.Encoder<A,B>>

public static interface Password.Encoder<A extends Password<A,B>,B extends Password.Encoder<A,B>>

A password encoder used to encode a raw password into a secured password representation.

  • Method Summary

    Modifier and Type
    Method
    Description
    Encodes the specified raw password.
    default boolean
    matches(A password, Password<?,?> other)
    Matches the specified passwords.
    boolean
    matches(String raw, String encoded)
    Matches the specified raw password with the specified encoded representation.
    recover(String encoded)
    Recovers a password from its encoded representation generated with this encoder.
  • Method Details

    • recover

      A recover(String encoded) throws PasswordException

      Recovers a password from its encoded representation generated with this encoder.

      Parameters:
      encoded - an encoded password representation
      Returns:
      a password
      Throws:
      PasswordException - if there was an error recovering the password or if the specified encoded representation was not generated with this encoder
    • encode

      A encode(String raw) throws PasswordException

      Encodes the specified raw password.

      Parameters:
      raw - a raw password
      Returns:
      an encoded password
      Throws:
      PasswordException - if there was an error encoding the password
    • matches

      boolean matches(String raw, String encoded) throws PasswordException

      Matches the specified raw password with the specified encoded representation.

      Parameters:
      raw - a raw password
      encoded - an encoded password
      Returns:
      true if passwords match, false otherwise
      Throws:
      PasswordException - if there was an error matching passwords
    • matches

      default boolean matches(A password, Password<?,?> other) throws PasswordException

      Matches the specified passwords.

      Parameters:
      password - a password
      other - another password
      Returns:
      true if passwords match, false otherwise
      Throws:
      PasswordException - if there was an error matching passwords or if passwords are of incompatible types