Class PasswordEncoders
-
- All Implemented Interfaces:
public class PasswordEncoders- Since:
2022-03-12
trydofor
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringNooppublic final static StringNeverpublic final static StringBasicpublic final static StringNoopMd5public final static StringNoopSha1public final static StringNoopSha256public final static StringBcryptpublic final static StringPbkdf2public final static StringScryptpublic final static StringArgon2public final static StringLdappublic final static StringMd4public final static StringMd5public final static StringPbkdf2V58public final static StringScryptV58public final static StringSha1public final static StringSha256public final static StringArgon2V58public final static StringSha256spublic final static StringMysql
-
Constructor Summary
Constructors Constructor Description PasswordEncoders()
-
Method Summary
Modifier and Type Method Description static Map<String, PasswordEncoder>getEncoders()static PasswordEncodergetEncoder(String encoder)static Stringencode(String encoder, CharSequence password)Encrypt the plain password into a hash static Stringdelegating(String encoder, CharSequence password)Use DelegatingPasswordEncoder to encode the password and output it in `{noop-md5}password` style. static Stringdelegated(String password, String encoder)Check that the password is in delegating({id}hash`) format, otherwise use the given encoder to encrypt it, if it fails use the noop-md5 encoder by default. static Map<String, PasswordEncoder>initEncoders(long basicMs)-
-
Method Detail
-
getEncoders
@NotNull() static Map<String, PasswordEncoder> getEncoders()
-
getEncoder
@Nullable() static PasswordEncoder getEncoder(String encoder)
-
encode
@Nullable() static String encode(String encoder, CharSequence password)
Encrypt the plain password into a hash
- Parameters:
encoder- encoder idpassword- plain password- Returns:
crypt password
-
delegating
@Nullable() static String delegating(String encoder, CharSequence password)
Use DelegatingPasswordEncoder to encode the password and output it in `{noop-md5}password` style.
- Parameters:
encoder- encoder idpassword- plain password- Returns:
`{id}hash`
-
delegated
@Contract(value = "!null, _ -> !null") static String delegated(String password, String encoder)
Check that the password is in delegating({id}hash`) format, otherwise use the given encoder to encrypt it, if it fails use the noop-md5 encoder by default.
- Parameters:
password- delegated or plain passwordencoder- encoder id- Returns:
`{id}hash`
-
initEncoders
@NotNull() static Map<String, PasswordEncoder> initEncoders(long basicMs)
-
-
-
-