Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Lock contention uses a stale timestamp for token validation and expiry calculations, and the concurrency behavior lacks tests.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds bounded synchronization to stateful token providers to prevent concurrent refresh-token reuse.
Changes:
- Adds an internal timed refresh lock and configurable timeout.
- Extends provider constructors while deprecating legacy signatures.
- Improves scheduled-future visibility.
File summaries
| File | Description |
|---|---|
AbstractStatefulUrlAccessTokenProvider.java |
Adds locking and timeout handling. |
StatefulUrlAccessTokenProvider.java |
Adds timeout constructor. |
AccessTokenProviderBuilder.java |
Supplies the default timeout. |
PreemptiveCachedAccessTokenProvider.java |
Makes scheduled future volatile. |
RestClientStatefulUrlAccessTokenProvider.java |
Adds timeout constructor. |
RestClientJwtClientBeanDefinitionRegistryPostProcessorSupport.java |
Supplies the default timeout. |
WebClientStatefulUrlAccessTokenProvider.java |
Adds timeout constructor. |
WebfluxJwtClientBeanDefinitionRegistryPostProcessorSupport.java |
Supplies the default timeout. |
RestTemplateStatefulUrlAccessTokenProvider.java |
Adds timeout constructor. |
RestTemplateJwtClientBeanDefinitionRegistryPostProcessorSupport.java |
Supplies the default timeout. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ider Co-authored-by: skjolber <1031478+skjolber@users.noreply.github.com>
|
skjolber
marked this pull request as draft
September 3, 2026 12:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



In most cases the above (wrapping) provider has a cache-with-lock mechanism already.
This makes extra sure that refresh tokens are not rotated and reused by a concurrent call.
Since there is a Lock we also need to pass a timeout so that nothing can block forever.
TODO: Better to create a generic wrapper and use it when appropriate?