-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add expireAt to OAuth2AuthorizationRequest and clean-up expired requests on save #7381
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
Add expireAt to OAuth2AuthorizationRequest and clean-up expired requests on save #7381
Conversation
…sts on save. Fixes gh-5145.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @AndreasKl.
There is quite a bit of coupling in the OAuth2AuthorizationRequestResolver
and AuthorizationRequestRepository
and it's implementations (and Reactive). I feel we should rework things to remove this coupling and potentially allow for reuse in other areas within the OAuth support, eg. expiring PK from a JWK Cache.
The expiring capability is really a cross-cutting concern. Can you try the following solution?
- Intercept calls to
loadAuthorizationRequest()
and store the information necessary - At a scheduled time (configurable with skew), the component will attempt to
loadAuthorizationRequest()
and if it returns than determine if time has expired and thanremoveAuthorizationRequest
Please take a look at the Cache abstraction to see if it would meet our needs.
@@ -55,6 +57,7 @@ | |||
private Map<String, Object> additionalParameters; | |||
private String authorizationRequestUri; | |||
private Map<String, Object> attributes; | |||
private Instant expiresAt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An Authorization Request does not have an expiresAt
attribute/parameter as per spec. This really is an implementation detail and should be externalized to the expiring component.
If you have time could you have a look at: #5145 (comment) . I'm now even more convinced that a size based solution could be a better match; we see a few Off the top of my head, I think the cache abstraction would impose a quite large runtime requirement to the user of spring security. The user than has to deploy a distributed cache for be able to prevent what is effectively a way to cause an OOM in an application. I definitely see the need for reducing the duplication and fully understand that |
I'm not convinced it's the right solution to use either but we should at least rule it out and give reasons for it. I'd prefer a very light solution.
I still think we should account for time-based as well. For low-load client applications, an |
Fixes gh-5145.