Skip to content

Conversation

franticticktick
Copy link
Contributor

Closes gh-16939

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 16, 2025
Copy link
Contributor

@evgeniycheban evgeniycheban left a comment

Choose a reason for hiding this comment

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

Hi, @franticticktick I've left one comment below with some thoughts regarding token value generation.

return null;
}
return new GenerateOneTimeTokenRequest(username, this.expiresIn);
return new GenerateOneTimeTokenRequest(username, this.expiresIn, this.tokenValueFactory.get());
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should not generate token value here, since it breaks the semantic of GenerateOneTimeTokenRequestResolver which is:
"A strategy for resolving a GenerateOneTimeTokenRequest from the HttpServletRequest".

It might also be confusing for users who provide a custom tokenValueFactory and notice that their factory gets called before OneTimeTokenService#generate method call.

So I would consider passing Supplier<String> tokenValueFactory to GenerateOneTimeTokenRequest and call it in the OneTimeTokenService#generate method.

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.

Add support one-time token value customization

3 participants