-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Support One-Time Tokens in a Clustered Environment #15735
Comments
Maybe the best solution would be to split this component into two? For example
With this implementation it is much easier to ensure |
Hi @CrazyParanoid, thanks for the report. Can you elaborate more on your use case? Would you like to authenticate the session that started the request instead of the session that submits the token? An alternative that I had in mind is to provide a public interface GenerateOneTimeTokenRequestResolver {
GenerateOneTimeTokenRequest resolve(HttpServletRequest request);
} This way you can return a subclass of |
This may be a good solution, but I would first look at the design of the |
I'm more interested in the ability of the |
I'm unsure because this.oneTimeTokenService.consume(ott);
this.oneTimeTokenRepository.delete(ott); What if the token value is a JWT, for example? It wouldn't have to be saved anywhere and the repository would be a no-op. |
@marcusdacoregio |
@CrazyParanoid I think that it makes sense for us to provide a |
Yes, I'll take it to work. I'll think about how best to extract the shared code, maybe something like:
Or something like this. |
@marcusdacoregio @rwinch could you please review PR? |
@CrazyParanoid Sorry about the delay. I've submitted a review now. |
Spring Security uses setter methods for optional member variables. Allows for a null cleanupCron to disable the cleanup. In a clustered environment it is likely that users do not want all nodes to be performing a cleanup because it will cause contention on the ott table. Another example is if a user wants to invoke cleanUpExpiredTokens with a different strategy all together, they might want to disable the cron job. Issue gh-15735
This improves readability. Issue gh-15735
It would be nice to implement session based
OneTimeTokenService
. Now this is difficult to do, becauseOneTimeTokenService
acceptsGenerateOneTimeTokenRequest
. It is better to change the design of thegenerate
method - replace GenerateOneTimeTokenRequest with HttpServletRequest.It is not yet clear how you can call
consume
for an http session.The text was updated successfully, but these errors were encountered: