Skip to content

Add dynamic advisory refresh window and update prefetch behavior#7093

Open
alextwoods wants to merge 1 commit into
feature/master/credential_cachefrom
alexwoo/credential_cache_pr4
Open

Add dynamic advisory refresh window and update prefetch behavior#7093
alextwoods wants to merge 1 commit into
feature/master/credential_cachefrom
alexwoo/credential_cache_pr4

Conversation

@alextwoods

Copy link
Copy Markdown
Contributor

Updates based on updates to cross-sdk spec

Modifications

  1. Dynamic advisory refresh window: When the user has NOT explicitly configured a prefetchTime, compute the advisory window dynamically based on the credential's remaining lifetime:

    • remaining < 20 min -> 5 min window
    • 20 min <= remaining < 90 min -> 15 min window
    • remaining >= 90 min -> 60 min window This is recomputed on each successful refresh. If the user HAS explicitly configured a value, it is always honored unchanged.
  2. Prefetch failure stale time preservation: When a credential refresh fails during the advisory (prefetch) window, extend the prefetch time by backoff but preserve the existing stale time if it is later than the new prefetch time. Previously both were set to the same backoff value, which could move the mandatory refresh boundary closer than intended.

Testing

New and existing tests.

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.

License

  • I confirm that this pull request can be released under the Apache 2 license

@alextwoods alextwoods requested a review from a team as a code owner June 30, 2026 17:27
@alextwoods alextwoods force-pushed the alexwoo/credential_cache_pr4 branch from 5816169 to d16468a Compare June 30, 2026 17:35
…ure stale time

Implement two changes from the updated cross-SDK credential refresh spec:

1. Dynamic advisory refresh window: When the user has NOT explicitly
   configured a prefetchTime, compute the advisory window dynamically
   based on the credential's remaining lifetime:
   - remaining < 20 min -> 5 min window
   - 20 min <= remaining < 90 min -> 15 min window
   - remaining >= 90 min -> 60 min window
   This is recomputed on each successful refresh. If the user HAS
   explicitly configured a value, it is always honored unchanged.

2. Prefetch failure stale time preservation: When a credential refresh
   fails during the advisory (prefetch) window, extend the prefetch
   time by backoff but preserve the existing stale time if it is later
   than the new prefetch time. Previously both were set to the same
   backoff value, which could move the mandatory refresh boundary
   closer than intended.

Affected providers: STS (all), IMDS, Container, SSO, Login, Process.
New utility: CacheRefreshUtils.computeDynamicPrefetchWindow()
@alextwoods alextwoods force-pushed the alexwoo/credential_cache_pr4 branch from d16468a to 64d7385 Compare June 30, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant