Skip to content

Implement UserDetailsPasswordService in JdbcUserDetailsManager #17071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jhl221123
Copy link

Summary:

Implements UserDetailsPasswordService in JdbcUserDetailsManager to allow password updates, controlled by a new flag.

Changes:

  • Added updatePassword(UserDetails user, String newPassword) method.
  • Introduced enableUpdatePassword boolean property (default: false) and setter setEnableUpdatePassword(boolean).
  • updatePassword method logic updated:
    • If enableUpdatePassword is true, it updates the user's password via updateUser.
    • If enableUpdatePassword is false, it returns the original UserDetails without performing any update.
  • Added tests in JdbcUserDetailsManagerTests to verify both scenarios (updatePasswordWhenDisabledReturnOriginalUser and updatePasswordWhenEnabledShouldUpdatePassword).

Closes gh-16863

@@ -65,7 +66,8 @@
* @author Luke Taylor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add your name on here?

Comment on lines +624 to +625
@Override
public UserDetails updatePassword(UserDetails user, String newPassword) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@Override
public UserDetails updatePassword(UserDetails user, String newPassword) {
@Override
/**
* comments like "updatePassword only when {@link #enableUpdatePassword} is true?
*/
public UserDetails updatePassword(UserDetails user, String newPassword) {

nit. how about adding comment about updatePassword flag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JdbcUserDetailsManager.setEnableUpdatePassword
3 participants