use of org.maxkey.crypto.password.StandardPasswordEncoder in project MaxKey by dromara.
the class ApplicationAutoConfiguration method passwordEncoder.
/**
* Authentication Password Encoder .
* @return
*/
@Bean(name = "passwordEncoder")
public PasswordEncoder passwordEncoder() {
String idForEncode = "bcrypt";
Map<String, PasswordEncoder> encoders = new HashMap<String, PasswordEncoder>();
encoders.put(idForEncode, new BCryptPasswordEncoder());
encoders.put("plain", NoOpPasswordEncoder.getInstance());
encoders.put("pbkdf2", new Pbkdf2PasswordEncoder());
encoders.put("scrypt", new SCryptPasswordEncoder());
// md
encoders.put("md4", new Md4PasswordEncoder());
encoders.put("md5", new MessageDigestPasswordEncoder("MD5"));
// sha
encoders.put("sha1", new StandardPasswordEncoder("SHA-1", ""));
encoders.put("sha256", new StandardPasswordEncoder());
encoders.put("sha384", new StandardPasswordEncoder("SHA-384", ""));
encoders.put("sha512", new StandardPasswordEncoder("SHA-512", ""));
encoders.put("sm3", new SM3PasswordEncoder());
encoders.put("ldap", new LdapShaPasswordEncoder());
// idForEncode is default for encoder
PasswordEncoder passwordEncoder = new DelegatingPasswordEncoder(idForEncode, encoders);
if (_logger.isTraceEnabled()) {
_logger.trace("Password Encoders :");
for (String key : encoders.keySet()) {
_logger.trace("{}= {}", String.format("%-10s", key), encoders.get(key).getClass().getName());
}
}
_logger.debug("{} is default encoder", idForEncode);
return passwordEncoder;
}
Aggregations