feat(oidc): support refresh token flow without id_token#3151
Open
appleboy wants to merge 1 commit into
Open
Conversation
- add --skip-require-id-token-on-refresh flag to login oidc command - add --oidc-skip-require-id-token-on-refresh flag to get kubeconfig, auto-embedded in exec args - add WithRequireIDTokenOnRefresh(bool) Option; defaults to true for backward compatibility - make handleRefresh() use the configurable requireIDToken value instead of hardcoded true - extend tokenCredential() to accept *oidctypes.Token and fall back to AccessToken when IDToken is nil - add nil guard with clear error when --enable-concierge is used without an id_token - update OIDCClientOptions interface and mock with new method - add unit tests covering happy path, default behavior, and error cases Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for pinniped-dev canceled.
|
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.
Some OIDC providers (e.g. AuthGate) do not return an
id_tokenin their refresh token response.Pinniped's
handleRefresh()previously required anid_tokenunconditionally, causing silentrefresh failures and triggering a browser-based re-login every time the token expired.
This PR adds an opt-in flag to allow the refresh flow to succeed without an
id_token,falling back to the
access_tokenwhen building theExecCredentialresponse.Changes:
--skip-require-id-token-on-refreshflag topinniped login oidc: when set, the refreshflow calls
ValidateTokenAndMergeWithUserInfowithrequireIDToken=falseand returns theaccess_tokenas the credential whenid_tokenis absent--oidc-skip-require-id-token-on-refreshflag topinniped get kubeconfig: automaticallyembeds
--skip-require-id-token-on-refreshinto the generated kubeconfig exec argsWithRequireIDTokenOnRefresh(bool)Option topkg/oidcclient; defaults totruetopreserve existing behavior for all other providers
tokenCredential()to accept*oidctypes.Tokenand fall back toAccessTokenwhenIDTokenis nil; extractapplyTokenToStatus()helper to remove duplicated logic--skip-require-id-token-on-refreshis usedtogether with
--enable-concierge(incompatible combination)OIDCClientOptionsinterface and its GoMock implementationRelease note: