Skip to content

2.0.0: OIDC callback returns OM's self-issued JWT instead of IdP's raw id_token, breaking custom jwtPrincipalClaimsMapping #32000

Closed

Description

@getsuo-devkk

Summary

Upgrading from 1.13.3 to 2.0.0 breaks OIDC/Okta login entirely for any deployment
using jwtPrincipalClaimsMapping with a custom (non-standard) source claim name.
Both the auto-redirect flow and the standard manual sign-in flow fail with:

{"code":401,"message":"Invalid JWT token, 'username' claim is not present"}

Environment

  • OpenMetadata chart/app version: 2.0.0 (regression from 1.13.3, which works correctly)
  • Auth provider: Okta OIDC, Authorization Code flow, confidential client
  • Relevant config:
    jwtPrincipalClaims:        [suffixed_name, email, preferred_username, sub]
    jwtPrincipalClaimsMapping: [username:suffixed_name, email:email]
    where suffixed_name is a custom Okta authorization-server claim (not a
    standard OIDC claim).
    

Root cause

AuthenticationCodeFlowHandler.sendRedirectWithToken changed which token it
hands back to the browser after the OIDC callback completes:

  • 1.13.3 (AuthenticationCodeFlowHandler.java, sendRedirectWithToken,
    around line 855): builds the redirect using
    credentials.getIdToken().getParsedString() — the IdP's raw ID token,
    which still carries the custom claim (suffixed_name) configured in
    jwtPrincipalClaimsMapping. Redirect shape:
    ?id_token=<idp_id_token>&email=...&name=...
  • 2.0.0 (same file/method, around line 561): builds the redirect using
    jwtAuthMechanism.getJWTToken() — OpenMetadata's own newly-minted,
    self-issued session JWT (from JWTTokenGenerator), which only ever embeds
    a fixed claim set (sub, roles, email, isBot, tokenType, username,
    preferred_username, sessionId) and never carries through arbitrary
    IdP-specific custom claims. Redirect shape:
    #id_token=<om_self_issued_token>&email=...&name=...

SecurityUtil.findUserNameFromClaims (unchanged between the two versions)
is then invoked against this token — both by JwtFilter on every subsequent
API call (since the frontend uses this same token as its bearer credential)
and implicitly by the frontend's own claim-reading logic. Because
jwtPrincipalClaimsMapping points at suffixed_name, and OM's self-issued
token never contains that key, resolution fails and throws
AuthenticationException("Invalid JWT token, 'username' claim is not present")
(SecurityUtil.java line 138).

Reproduction

  1. Configure OIDC with a jwtPrincipalClaimsMapping entry whose source claim
    is a custom IdP claim not present in OM's own JWT schema
    (e.g. username:suffixed_name).
  2. Sign in via Okta (Authorization Code flow, confidential client).
  3. Observe the callback redirect: .../auth/callback#id_token=&email=...&name=...
  4. Decode id_token — it is OM's own self-issued token (iss is the
    OpenMetadata server's own domain), and correctly contains
    "username": "" already — proving the initial claim
    resolution against the IdP's token succeeded.
  5. GET /api/v1/users/loggedInUser (or any authenticated endpoint) using that
    same id_token as the Bearer token returns:
    {"code":401,"message":"Invalid JWT token, 'username' claim is not present"}
    — confirmed via direct curl, independent of any frontend code.
  6. This reproduces identically across two fully independent environments
    (separate Okta applications/client IDs), ruling out IdP-side misconfiguration.

Expected behavior

Either:

  • The callback should continue to hand back the IdP's raw ID token (matching
    1.13.3 behavior), so claim-mapping configured against the IdP's claims
    keeps working, or
  • If OM's own self-issued token is now the intended vehicle, claim resolution
    for that token should use OM's own fixed schema (username, preferred_username,
    etc.) rather than blindly re-applying the IdP-oriented
    jwtPrincipalClaimsMapping to a token that was never meant to carry
    arbitrary IdP claims through.

Impact

Any 2.0.0 deployment configuring jwtPrincipalClaimsMapping against a custom
IdP claim (common for organizations deriving usernames from email with
custom normalization/disambiguation logic) will have login completely broken —
not a corner case limited to any particular "auto redirect" feature; this is
the core Authorization Code callback path.

Workaround considered and rejected

Switching jwtPrincipalClaimsMapping to a claim OM's self-issued token does
carry (e.g. preferred_username) avoids the crash, but silently reintroduces
a username-collision bug that suffixed_name was specifically created to
prevent (disambiguating users across subdomains that share a local-part,
e.g. user@example.com vs user@sub.example.com). Not a safe fix for our
case.

Activity

  1. moved this to Release Backlog 🚧 in Shippingon Aug 25, 2026
  2. added theissue type on Aug 26, 2026
  3. added
    bug
    on Aug 26, 2026
  4. removed their assignment
    on Oct 9, 2026
  5. added a commit that references this issue on Oct 12, 2026
    0cf5851
  6. moved this from Release Backlog 🚧 to Done ✅ in Shippingon Oct 16, 2026
  7. added a commit that references this issue on Oct 16, 2026
    a45146f
  8. added a commit that references this issue on Oct 16, 2026
    d21bb2a
  9. added a commit that references this issue on Oct 17, 2026
    ca57b64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

  • Status
    Done ✅

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions