[Credential Cache Pr 2/3] Enable static stability for STS, Container, SSO, and Login credential providers#7031
Open
alextwoods wants to merge 2 commits into
Open
Conversation
…tingPredicate - STS, Container, SSO, and Login providers now use StaleValueBehavior.ALLOW - SSO provider configures cacheInvalidatingPredicate for ExpiredTokenException and UnauthorizedException (original exceptions propagate unchanged) - Login provider configures cacheInvalidatingPredicate for AccessDeniedException with TOKEN_EXPIRED or USER_CREDENTIALS_CHANGED error codes - Removes all CacheInvalidatingException wrapping — service exceptions flow through to customers unchanged
RanVaknin
reviewed
Jun 12, 2026
RanVaknin
reviewed
Jun 12, 2026
| // Let the original AccessDeniedException propagate — the cacheInvalidatingPredicate | ||
| // on CachedSupplier will identify it and bypass static stability. | ||
| throw accessDeniedException; | ||
| case INSUFFICIENT_PERMISSIONS: |
Contributor
There was a problem hiding this comment.
Shouldn't this one also be treated as non-recoverable?
Contributor
Author
There was a problem hiding this comment.
Yeah, good question - I'll follow up with the spec owner for this....
Contributor
Author
There was a problem hiding this comment.
Good call out - yes, it should be cache invalidating! I'll update the code and spec is being updated as well.
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.
This PR merges to feature/master/credential_cache, NOT to master
[Credential Cache Pr 2/3].
Motivation and Context
This is part 2 of 3 implementing the cross-SDK Credential Refresh Behavior SEP. With the
CachedSupplierALLOW behavior established in PR 1, this PR switches the relevant credential providers to use it — so that refresh failures return cached credentials instead of propagating exceptions to callers.Additionally, this PR wraps non-recoverable authentication errors (expired SSO tokens, changed Login passwords) in
CacheInvalidatingExceptionso they bypass static stability and are immediately surfaced to the user.PR chain: PR 1: CachedSupplier ALLOW engine → PR 2 (this) → [PR 3: Unified timing configuration]
Depends on: #7028
Modifications
StsCredentialsProvider: Added.staleValueBehavior(CachedSupplier.StaleValueBehavior.ALLOW)to the CachedSupplier builder. On refresh failure, STS providers now return cached credentials instead of throwing. Initial fetch failure (no cache) still throws.ContainerCredentialsProvider: Added.staleValueBehavior(ALLOW)to the CachedSupplier builder. Container metadata endpoint failures now return cached credentials.SsoCredentialsProvider: Added.staleValueBehavior(ALLOW).UnauthorizedException(from SSO service) andExpiredTokenExceptionare considered cache invalidating exceptions so expired SSO tokens bypass static stability and immediately prompt re-authentication.LoginCredentialsProvider: Added.staleValueBehavior(ALLOW). MadeTOKEN_EXPIREDandUSER_CREDENTIALS_CHANGEDerrors cache invalidating.ProcessCredentialsProvider: Intentionally NOT changed — keepsSTRICTbehavior since process execution is local and we do not know the source of the credentials.Testing
New tests for static stability in updated credential providers.
Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License