Skip to content

SEC-2566: Support password storage upgrades #2778

Closed
@spring-projects-issues

Description

@spring-projects-issues

Rob Winch (Migrated from SEC-2566) said:

After verifying a user's password successfully check to see if the format the password was stored in is up to date. If not, upgrade the storage of the password.

A developer can ensure that passwords that need to be upgraded are now upgraded on authentication success by exposing a UserDetailsPasswordService as a Bean.

The changes for this ticket include:

  • PasswordEncoder.upgradeEncoding allows checking to see if a password should be upgraded
  • Passwords can be upgraded using UserDetailsPasswordService and ReactiveUserDetailsPasswordService. Both InMemoryUserDetailsManager and MapReactiveUserDetailsService now implement these interfaces.
  • DaoAuthenticationProvider and UserDetailsRepositoryReactiveAuthenticationManager can have a UserDetailsPasswordService or ReactiveUserDetailsPasswordService injected which on authentication success will trigger the password to be upgraded if the PasswordEncoder.upgradeEncoding returns true.

NOTE: JdbcUserDetailsManager and LdapUserDetailsManager do not implement UserDetailsPasswordService because they would then try to upgrade the passwords automatically which would potentially cause user's production code to break. For example, encoding the password is likely to cause the password to be too large to fit into the default schema. Another example is if the user has custom queries for the user and do not plan on using it for updates, they may not have set the update sql which means updating would break log in (which might try to log in).

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreAn issue in spring-security-coretype: jiraAn issue that was migrated from JIRA

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions