Skip to content

Add configurable ID token subject claim format and order - #5008

Open
aduewel wants to merge 1 commit into
dexidp:masterfrom
aduewel:plaintext_subjectClaim_support
Open

aduewel wants to merge 1 commit into
dexidp:masterfrom
aduewel:plaintext_subjectClaim_support

Conversation

@aduewel

@aduewel aduewel commented Sep 9, 2026

Copy link
Copy Markdown

Overview

Add configurable formats and field ordering for Dex OAuth2/OIDC sub claims.

What this PR does / why we need it

  • Preserve the existing base64-encoded protobuf subject claim as the default.
  • Add a URL-escaped plain subject format suitable for AWS IAM trust policies and wildcard matching.
  • Add configurable user-connector and connector-user ordering.
  • Preserve compatibility when parsing existing subjects across logout, introspection, auth flow, and refresh-token API paths.
  • Document the new oauth2.subjectClaim and oauth2.subjectClaimOrder options and add coverage for configuration, encoding, parsing, and integration paths.

The plain format avoids protobuf length-prefix bytes in the claim, allowing AWS StringLike conditions to match meaningful subject components.

Special notes for your reviewer

  • Default behavior remains unchanged: base64 format with user ID before connector ID.
  • Compatibility aliases for the previous terminology remain accepted.
  • Validation: go test ./... passes.

Add oauth2.subjectClaim with base64 (default) and plain formats, and add oauth2.subjectClaimOrder to control plain sub ordering (user-connector or connector-user).

Keep compatibility by accepting legacy aliases, and by applying configured order consistently across issuer, authflow id_token_hint matching, logout parsing, introspection, and API refresh operations.

Update config examples/docs and extend tests for format/order parsing and behavior.

Co-authored-by: AI Assistant
Signed-off-by: André Düwel <andre.duewel@mercedes-benz.com>
@aduewel
aduewel force-pushed the plaintext_subjectClaim_support branch from f1ab107 to 1dc587d Compare September 9, 2026 07:39
@aduewel

aduewel commented Sep 11, 2026

Copy link
Copy Markdown
Author

Hi @nabokihms may I ask for a review here? Or is an issue mandatory for such an additional feature?

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.

1 participant