feat(oidc): mirror bunyip_role into the ID token (PMS-158) #86
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/bunyip-emit-role-claim"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Mirror the
bunyip_roleclaim into the OIDC ID token. BUNYIP-66 added it to the at+jwt access token (for resource servers to translate); this adds it to the ID token so a relying party that reads only the ID token (e.g. a SPA rendering the signed-in user's role) can display / translate the role without an extra userinfo call.Changes
bunyip_role: Option<String>toIdTokenClaims(skip_serializing_if = "Option::is_none", so an ID token from an older build still deserializes).IdTokenClaims::build(...)(mirroringAtClaims::buildfrom BUNYIP-66) so the claim mapping is unit-testable;mint_id_tokennow computesat_hashand delegates.bunyip_roleis emitted on every mint regardless of scope (identity-level, not gated onemail).Tests
id_token_carries_bunyip_role,id_token_bunyip_role_emitted_without_email_scope,id_token_bunyip_role_serializes_under_expected_key,id_token_deserializes_without_bunyip_role. All 9bunyip-oidcunit tests pass;clippy --all-targets -- -D warningsandcargo fmt --checkclean.Context
The bunyip half of mokosh PMS-158 (the signed-in user's role always shows as
technician). Bunyip never emitted its role in tokens, so mokosh-server's PMS-172 translation always sawbunyip_role = Noneand kept the JITtechniciandefault. The access-token half shipped in BUNYIP-66; this completes the ID-token side.🤖 Generated with Claude Code