parent
2621a850a9
commit
cb59684bd4
@ -0,0 +1,19 @@
|
|||||||
|
package org.sang.config;
|
||||||
|
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.DigestUtils;
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class MyPasswordEncoder implements PasswordEncoder {
|
||||||
|
@Override
|
||||||
|
public String encode(CharSequence rawPassword) {
|
||||||
|
return DigestUtils.md5DigestAsHex(rawPassword.toString().getBytes());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean matches(CharSequence rawPassword, String encodedPassword) {
|
||||||
|
return encodedPassword.equals(DigestUtils.md5DigestAsHex(rawPassword.toString().getBytes()));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue