Concept
An AuthenticationProvider checks credentials against a source, such as users in a database with hashed passwords, and produces an Authentication the rest of the chain trusts. Spring ships providers; you supply the UserDetailsService.
The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.
A few lines that show Authentication providers doing its job.
@Bean
UserDetailsService users(UserRepository repo) {
return username -> repo.findByEmail(username)
.map(u -> User.withUsername(u.email())
.password(u.passwordHash())
.roles(u.role().name())
.build())
.orElseThrow(() -> new UsernameNotFoundException(username));
}
@Bean
PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); }Storing passwords with a fast hash such as SHA-256, or none at all. Use the PasswordEncoder with bcrypt or argon2, and never log or return the hash.
Your roadmap puts these before Authentication providers, unless you already know them.
Once a session shows you understand Authentication providers, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.
Topics that build on Authentication providers.