feat(oidc): emit bunyip_role claim in at+jwt for resource servers (BUNYIP-66) #81
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/bunyip-66-emit-bunyip-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?
Problem
Bunyip's
at+jwt(RFC 9068) did not carry the authenticated user's Bunyip system role.AtClaimshad no role claim and/oauth2/userinfodid not return it either, so resource servers (mokosh-server on its RS path) could not derive authorization from the verified token and fell back to a local default: a Bunyipadminwas seen as a low-privilege user.Change
pub bunyip_role: StringtoAtClaims, populated on everymint_access_tokenfrom the user's role (the DB column, already constrained toUserRole::as_str()values:subscriber|admin).allowed_scopes), not the user's system role; consumers mapbunyip_roleto their own taxonomy (PMS-172), Bunyip exposes only its own role.mint_access_tokeninto a pureAtClaims::buildso the mapping is unit-testable without keys or a database.bunyip_rolein the discovery document'sclaims_supported.Tests
crates/bunyip-oidc/src/services/oidc_provider.rs:bunyip_role = "admin"bunyip_role = "subscriber"bunyip_rolethe mokosh RS parsesVerification
just check-containergreen: fmt, clippy-D warnings, full workspace tests (4 new tests pass).Coordination
The claim name
bunyip_rolematches what the mokosh consumer parses; mokosh-side translation is tracked in PMS-172 (linked depend).Closes BUNYIP-66.