spring-projects / spring-projects/spring-security

SEC-2428: support "last password change date" in the DB schema

Open
#2,649 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: web type: enhancement type: jira
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

ohad redlich (Migrated from SEC-2428) said:

I would like to support the feature that after the user logs-in, I can tell if it is time for him to change his password. For this, I need to add in the DB, better in the 'users' schema, another column of DATE, that indicates the last time this user has set his password.
Currently, if I work with Spring-security, and I use the current 'users' schema, I cannot support this feature.
BTW, this way developers will be able to use UserDetails.isAccountExpired(), which is currently useless. Or maybe we can add another method for this use-case...

changes required:

  1. new column in the DB, 'LAST_PASSWORD_CHANGE_DATE'.
  2. JdbcUserDetailsManager:
    2.a the queries (for create account, for example) will have to change.
    2.b. changePassword(): it will have to set a new value in the 'LAST_PASSWORD_CHANGE_DATE'.
  3. interface 'UserDetails' and implelemtor 'User' will have to change accordingly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the current users schema and the JdbcUserDetailsManager, then trace the UserDetails interface and User implementation. Update the account-creation queries and changePassword() behavior around LAST_PASSWORD_CHANGE_DATE, and define the corresponding user API so the password-change date can be used after login.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, databases, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.