Use PasswordEncoder replace new

2.0.1
monkeyk7 5 years ago
parent 45dadbefdd
commit 2f90b746fb

@ -1,6 +1,7 @@
package com.monkeyk.sos.infrastructure;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import com.monkeyk.sos.web.context.SOSContextHolder;
import org.springframework.security.crypto.password.PasswordEncoder;
/**
* 2016/3/25
@ -10,12 +11,16 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
public abstract class PasswordHandler {
// private PasswordEncoder passwordEncoder = SOSContextHolder.getBean(PasswordEncoder.class);
private PasswordHandler() {
}
public static String encode(String password) {
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
return encoder.encode(password);
PasswordEncoder passwordEncoder = SOSContextHolder.getBean(PasswordEncoder.class);
// BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
return passwordEncoder.encode(password);
}
}

Loading…
Cancel
Save