Skip to content

[Credential Cache Pr 2/3] Enable static stability for STS, Container, SSO, and Login credential providers#7031

Merged
alextwoods merged 2 commits into
feature/master/credential_cachefrom
alexwoo/credential_cache_pr2
Jun 18, 2026
Merged

[Credential Cache Pr 2/3] Enable static stability for STS, Container, SSO, and Login credential providers#7031
alextwoods merged 2 commits into
feature/master/credential_cachefrom
alexwoo/credential_cache_pr2

Conversation

@alextwoods

Copy link
Copy Markdown
Contributor

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 CachedSupplier ALLOW 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 CacheInvalidatingException so 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) and ExpiredTokenException are considered cache invalidating exceptions so expired SSO tokens bypass static stability and immediately prompt re-authentication.

  • LoginCredentialsProvider: Added .staleValueBehavior(ALLOW). Made TOKEN_EXPIRED and USER_CREDENTIALS_CHANGED errors cache invalidating.

  • ProcessCredentialsProvider: Intentionally NOT changed — keeps STRICT behavior 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

  • 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

…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
@alextwoods alextwoods requested a review from a team as a code owner June 11, 2026 21:47
@alextwoods alextwoods requested a review from RanVaknin June 12, 2026 15:04
@alextwoods alextwoods merged commit d1e6f77 into feature/master/credential_cache Jun 18, 2026
2 of 3 checks passed
@alextwoods alextwoods deleted the alexwoo/credential_cache_pr2 branch June 18, 2026 17:32
@github-actions

Copy link
Copy Markdown

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants