feat(openid-connect): add set_enc_id_token_header option#13616
Open
luarx wants to merge 1 commit into
Open
Conversation
Add a new boolean plugin option `set_enc_id_token_header` (default: false) that, when enabled, forwards the raw RS256-signed ID token JWT to upstream services via the `X-Enc-ID-Token` request header. Unlike the existing `X-ID-Token` header (which contains `base64(JSON(decoded_claims))` with no cryptographic signature), `X-Enc-ID-Token` carries the original signed token that can be verified against the identity provider's JWKS endpoint. Implementation notes: - The header is cleared at rewrite entry to prevent client injection. - When the user has explicitly restricted `session_contents`, the plugin automatically adds `enc_id_token` to the list so the raw JWT is persisted in the session by lua-resty-openidc. - When `session_contents` is nil (the default), lua-resty-openidc stores all session data including `enc_id_token`, so no action is needed. - The feature is only available in the full OIDC session flow (not in the bearer/introspection path, where no session exists). Closes apache#13615
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.
Description
Add a new boolean plugin option
set_enc_id_token_header(default:false) that, whenenabled, forwards the raw RS256-signed ID token JWT to upstream via the
X-Enc-ID-Tokenrequest header.
Unlike the existing
X-ID-Tokenheader (which containsbase64(JSON(decoded_claims))withno cryptographic signature),
X-Enc-ID-Tokencarries the original signed token verifiableagainst the identity provider's JWKS endpoint.
Implementation details:
ensures
enc_id_tokenis included so the raw JWT is persisted in the session bylua-resty-openidc. When
session_contentsis nil (the default), lua-resty-openidc stores allsession data including
enc_id_token, so no action is needed.no session exists).
Which issue(s) this PR fixes:
Fixes #13615
Checklist
APISIX mailing list first)