October 2018
Intermediate to advanced
590 pages
15h 5m
English
As mentioned, our implementation of PasswordEncryptor will delegate the actual encryption to Spring Security's PasswordEncoder implementation. Here is how PasswordEncryptorDelegate looks:
...@Componentpublic class PasswordEncryptorDelegate implements PasswordEncryptor { private PasswordEncoder passwordEncoder; public PasswordEncryptorDelegator(PasswordEncoder passwordEncoder) { this.passwordEncoder = passwordEncoder; } @Override public String encrypt(String rawPassword) { return encoder.encode(rawPassword); }}
As you can see, this is quite straightforward. Spring Security offers multiple implementations of PasswordEncoder, and we will use BCryptPasswordEncoder here. Let's instantiate BCryptPasswordEncoder ...
Read now
Unlock full access