Interface PasswordEncoder

All Known Implementing Classes:
BCryptPasswordEncoder, DelegatingPasswordEncoder, NoOpPasswordEncoder, Pbkdf2PasswordEncoder, Pbkdf2Sha256PasswordEncoder

public interface PasswordEncoder
Turns a password into what is stored, and checks a password against it.
  • Method Summary

    Modifier and Type
    Method
    Description
    encode(CharSequence rawPassword)
    The password as it should be stored: salted and hashed, so encoding one password twice gives two different results.
    boolean
    matches(CharSequence rawPassword, String encodedPassword)
    Whether rawPassword is the password encodedPassword was made from.
    default boolean
    upgradeEncoding(String encodedPassword)
    Whether encodedPassword should be encoded again for better protection: it was made by an older scheme, or with fewer rounds than this encoder uses now.
  • Method Details

    • encode

      String encode(CharSequence rawPassword)
      The password as it should be stored: salted and hashed, so encoding one password twice gives two different results.
    • matches

      boolean matches(CharSequence rawPassword, String encodedPassword)
      Whether rawPassword is the password encodedPassword was made from.
    • upgradeEncoding

      default boolean upgradeEncoding(String encodedPassword)
      Whether encodedPassword should be encoded again for better protection: it was made by an older scheme, or with fewer rounds than this encoder uses now.