Skip to content

Validate account status in OneTimeTokenAuthenticationProvider - #17656

Merged
jzheaux merged 4 commits into
spring-projects:mainfrom
therepanic:gh-17655
Aug 11, 2026
Merged

Validate account status in OneTimeTokenAuthenticationProvider#17656
jzheaux merged 4 commits into
spring-projects:mainfrom
therepanic:gh-17655

Conversation

@therepanic

@therepanic therepanic commented Aug 2, 2025

Copy link
Copy Markdown
Contributor

The main problem is that OneTimeTokenAuthenticationProvider does not extend from AbstractUserDetailsAuthenticationProvider, which has a preauthentication check for user details. However, we do not need to extend from it because it does not fit the context of the class. In this regard, I decided to add my own checker to this commit, which performs a preauthentication check before authorizing the account, similar to how it is done in AbstractUserDetailsAuthenticationProvider. I also added a test to OneTimeTokenAuthenticationProviderTests that identifies this problem.

Closes: #17655

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 2, 2025
@therepanic
therepanic force-pushed the gh-17655 branch 2 times, most recently from c7c8f08 to 971a23c Compare August 2, 2025 13:30
@therepanic
therepanic marked this pull request as ready for review August 2, 2025 13:31
@tinystorm

Copy link
Copy Markdown

Hi, thanks for the work on this PR!

This feature would be very useful for us.
Is there any update on the status of this PR or plans for merging it?

Appreciate the effort!

@jzheaux jzheaux left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, @therepanic, for the PR! I've left some feedback inline.

@jzheaux jzheaux self-assigned this Mar 31, 2026
@jzheaux jzheaux added in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 31, 2026
@jzheaux jzheaux added this to the 7.2.0-M1 milestone Aug 11, 2026
therepanic and others added 3 commits August 11, 2026 14:27
The main problem is that OneTimeTokenAuthenticationProvider does not
extend from AbstractUserDetailsAuthenticationProvider, which has a
preauthentication check for user details. However, we do not need to
extend from it because it does not fit the context of the class. In this
regard, I decided to add my own checker to this commit, which performs a
preauthentication check before authorizing the account, similar to how
it is done in AbstractUserDetailsAuthenticationProvider. I also added a
test to OneTimeTokenAuthenticationProviderTests that identifies this
problem.

Closes spring-projectsgh-17655

Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
OneTimeTokenAuthenticationProvider no longer validates account status
by default. Applications can opt in via setUserDetailsChecker, for
example by providing AccountStatusUserDetailsChecker to reject locked,
disabled, or expired accounts.

Issue spring-projectsgh-17655

Signed-off-by: Josh Cummings <3627351+jzheaux@users.noreply.github.com>
…nager

Add the same opt-in UserDetailsChecker support to
OneTimeTokenReactiveAuthenticationManager, mirroring
OneTimeTokenAuthenticationProvider for the reactive stack.

Issue spring-projectsgh-17655

Signed-off-by: Josh Cummings <3627351+jzheaux@users.noreply.github.com>
Signed-off-by: Josh Cummings <3627351+jzheaux@users.noreply.github.com>
@jzheaux
jzheaux merged commit 30cc0f2 into spring-projects:main Aug 11, 2026
7 checks passed
@jzheaux

jzheaux commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Thanks, @therepanic! This is now merged into main and will go out in the next milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OneTimeTokenAuthenticationProvider should validate UserDetails account status like DaoAuthenticationProvider

5 participants