A hash prefix identifies the password encoder that should verify a stored password hash. DelegatingPasswordEncoder reads the prefix and routes matching to the registered implementation. section 4.1.4
Use the prefix as part of the stored hash format:
- Wrap the encoder key in mandatory curly braces, such as {bcrypt} or {noop}. section 4.1.4
- Map each key to a PasswordEncoder, such as BCryptPasswordEncoder, SCryptPasswordEncoder, or NoOpPasswordEncoder. section 4.1.4
- Treat an unprefixed hash with the default encoder selected when DelegatingPasswordEncoder is constructed; the shown configuration defaults to bcrypt. section 4.1.4
Stored hash examples
For {noop}12345, delegation selects NoOpPasswordEncoder. A hash beginning with {bcrypt}, such as {bcrypt}$2a$10$xn3LI/AjqicFYZFruSwve.681477XaVNaUQbr1gioaWPn4t1KsnmG, selects BCryptPasswordEncoder. section 4.1.4
