Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public interface PasswordEncoder
Known subtypesBCryptPasswordEncoder, DelegatingPasswordEncoder, ModularPbkdf2PasswordEncoder, NoOpPasswordEncoder, Pbkdf2PasswordEncoder, Pbkdf2Sha256PasswordEncoder, Sha256HexPasswordEncoder
Turns a password into what is stored, and checks a password against it.
Methods
public abstract String encode(CharSequence rawPassword) | The password as it should be stored: salted and hashed, so encoding one password twice gives two different results. |
public abstract boolean matches(CharSequence rawPassword, String encodedPassword) | Whether rawPassword is the password encodedPassword was made from. |
public 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
public abstract String encode(CharSequence rawPassword)The password as it should be stored: salted and hashed, so encoding one
password twice gives two different results.
matches
public abstract boolean matches(CharSequence rawPassword, String encodedPassword)Whether
rawPassword is the password encodedPassword was made from.upgradeEncoding
public 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.