liveBook · Manning

PasswordEncoder

As explained in Spring in Action, Sixth Edition

PasswordEncoder is a Spring Security interface for transforming plaintext passwords into encoded representations suitable for secure storage and verification.

PasswordEncoder is a Spring Security interface that transforms a submitted plaintext password into an encoded value before the user record is saved. Authentication can then check the submitted password against the stored representation. section 5.2.2

Encoding a registration password

Inject the shared PasswordEncoder into RegistrationController, then pass it to RegistrationForm.toUser(). That method calls passwordEncoder.encode(password) while creating the User, so the database receives the encoded password rather than the submitted plaintext value. section 5.2.2

How Spring in Action, Sixth Edition covers it

How deep it goes
Explains injection and the encode call in registration, but does not detail encoding algorithms or verification internals.
Examples
Uses RegistrationController and RegistrationForm.toUser() to encode a submitted password before saving a User.
What it assumes
Assumes a Spring Security authentication flow, a User entity, and persistence through a user repository.
What you can do after
Apply it via dependency injection and RegistrationForm.toUser() to store encoded passwords during user registration.
How it connects
Connects PasswordEncoder with Spring MVC registration, User entities, repositories, and the user details service.

Also explained in

Compare how 2 books explain PasswordEncoder →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.