liveBook · Manning

Password encoding

As explained in Spring in Action, Sixth Edition

Password encoding is the one-way transformation of a plaintext password into a stored representation used for later credential verification.

Password encoding transforms a submitted plaintext password into a stored representation before registration saves the user. Later, the user details service authenticates against that encoded value. section 5.2.2

Encoding during Taco Cloud registration

RegistrationController receives a PasswordEncoder and passes it to RegistrationForm.toUser(). That method calls passwordEncoder.encode(password) while constructing the User object, so UserRepository saves the encoded password rather than the submitted plaintext. section 5.2.2

The registration flow places encoding between form submission and persistence:

  • Bind the registration form fields to RegistrationForm. section 5.2.2
  • Save the resulting user so authentication can use the encoded password. section 5.2.2

How Spring in Action, Sixth Edition covers it

How deep it goes
Defines the registration-time transformation and shows its placement in RegistrationForm.toUser(), without detailing the encoding algorithm.
Examples
Uses Taco Cloud registration, RegistrationForm.toUser(), and a persisted User entity as the working example.
What it assumes
Uses Spring MVC form binding and UserRepository persistence, then teaches where PasswordEncoder belongs in registration.
What you can do after
Apply it via Spring Security’s PasswordEncoder by encoding a submitted password before saving a User.
How it connects
Connects PasswordEncoder with user registration, UserRepository, UserDetailsService, and authentication.

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.