Repository navigation
Description
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
- 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). - Sign in via Okta (Authorization Code flow, confidential client).
- Observe the callback redirect: .../auth/callback#id_token=&email=...&name=...
- 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. - 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. - 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.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone ✅
Activity
Fixes #32000: Mint IdP-shaped principal claims in JWTTokenGenerator […
Fixes open-metadata#32000, open-metadata#33553: Hand confidential OID…
Fixes #32000, #33553: Hand confidential OIDC browsers the identity pr…
Dark-mode and contrast fixes, Classic mode deprecation notice, Insigh…