Skip to content

feat(aws): refresh named SSO session access tokens - #903

Merged
Xuanwo merged 8 commits into
mainfrom
xuanwo/sso-token-refresh
Oct 5, 2026
Merged

Xuanwo merged 8 commits into
mainfrom
xuanwo/sso-token-refresh

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Closes #898. Builds on the shared AWS configuration loader introduced in #902.

Named SSO sessions renew expired access tokens through Context::http_send using cached OIDC registration and refresh material. Configuration is resolved through the shared AWS loader from #902, including literal command values. This includes named-session resolution and cache selection from #856, without implementing assume-role profile graphs.

Each internal SsoSession owns its token state and refresh lock. Provider clones share sessions, but a blocked refresh does not block another session. Disk JSON is converted into typed in-memory state with Timestamp expirations. A successful refresh replaces the complete token state before requesting role credentials, preserving rotated refresh tokens across role-exchange failures. Rejected grants require login; throttling (including HTTP 400 slow_down) and transient failures remain retryable without exposing response descriptions or secrets.

The AWS default provider executes SSO between its preceding and following provider chains and propagates SSO errors directly. Absent SSO configuration continues resolution. Core APIs are unchanged, as are custom ProvideCredentialChain behavior, with_chain, slot removal, and push_front precedence.

Refreshed material remains in memory for the provider and its clones. The AWS CLI cache is never written, independent providers/processes do not coordinate, and restarting requires usable on-disk refresh material. Once an in-memory token expires, a newer CLI login cache can replace it. Legacy inline configuration remains non-refreshable and no interactive login is started.

Tests use synthetic files and HTTP responses, a controlled clock, and gated concurrent calls. Coverage includes rotation and subsequent refresh, independent-session progress, same-session coordination, failed role exchanges, default-chain boundaries, and the reported non-SSO configuration reproducer. No developer SSO cache or real SSO account is required.

@Xuanwo
Xuanwo marked this pull request as ready for review October 5, 2026 05:04
@Xuanwo
Xuanwo merged commit f0752d1 into main Oct 5, 2026
64 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/sso-token-refresh branch October 5, 2026 05:42
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.

feat(aws): refresh cached access tokens for named SSO sessions

1 participant