PasswordEncoder and upgrades
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
store and check passwords with Spring's PasswordEncoder.
Planned topics
PasswordEncoderhasencode(raw)andmatches(raw, stored).- Use
BCryptPasswordEncoderorArgon2PasswordEncoder. PasswordEncoderFactories.createDelegatingPasswordEncoder()stores an id prefix like{bcrypt}, so you can change algorithms later.upgradeEncodingtells you when a stored hash is weaker than the current setting; re-hash on the next successful login.- Expose the encoder as a
@Bean; Spring Security picks it up.
Draft outline details
Demonstration
@Bean
PasswordEncoder passwordEncoder() {
return PasswordEncoderFactories.createDelegatingPasswordEncoder();
}Check your understanding
What does the {bcrypt} prefix make possible?
Show answer
Moving to a new algorithm later while old hashes still work.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.