Interface PasswordEncoder


public interface PasswordEncoder
Encoder of a password. It implements one of the possible kinds of PasswordEncoding. You can use it to encode password for secure storage, and then to check the password against stored encoded password.
  • Method Details

    • encodeAsync

      CompletableFuture<String> encodeAsync(String password)
      Encodes a password. Returns encoded password, which can be safely stored and later matched against raw password with this instance of PasswordEncoder.
      Parameters:
      password - raw password to be encoded.
      Returns:
      encoded version of a password. It can contain embedded information about encoding itself such as encoding depth, algorithm version and generated salt used to encode a password.
    • matchAsync

      CompletableFuture<Boolean> matchAsync(String rawPassword, String encodedPassword)
      Matches raw password against encoded password.
      Parameters:
      rawPassword - raw password to be matched.
      encodedPassword - password encoded with the algorithm implemented by this PasswordEncoder.
      Returns:
      Future completed with true if raw password matches encoded password.
    • isValidFormat

      boolean isValidFormat(String encodedPassword)
      Checks if the encoded password looks like it is valid to be matched with this password encoder.
      Parameters:
      encodedPassword - Encoded password to check.
      Returns:
      true if this encoded password string seems like validly encoded with the algorithm used by this encoder.