feat(jit): consume bunyip given_name/family_name claims (BUNYIP-141) #327

Merged
YousifShkara merged 1 commit from feat/bunyip-141-jit-consume-name-claims into main 2026-06-21 09:43:59 +02:00
Owner

Third slice of BUNYIP-103, mokosh-server half. Bunyip's /oauth2/userinfo
now emits given_name + family_name standard OIDC claims when the at+jwt's
scope set carries profile AND the user has filled them in on bunyip
(BUNYIP-139 + BUNYIP-140). Wire those claims through to the JIT path so
a bunyip-provisioned user lands in mokosh-server with their real name on
first sight instead of synthetic_name_from_email's email-local-part
placeholder.

  • oidc_rs::UserInfo adds optional given_name / family_name /
    phone_number (the third unused by mokosh today but pinned for the
    next env change). NULL columns serialize as ABSENT per BUNYIP-140, so
    Option<String> is the right shape for every branch.
  • ensure_user_from_bunyip (middleware) reads them off the same
    userinfo round-trip that already fetches email + email_verified.
  • place_bunyip_user adds two args threading the hints to
    upsert_user_from_oidc. Suppressed clippy::too_many_arguments locally
    since bundling these into a synthetic struct would force every test
    call site (7 of them) to construct that struct from the same fields.
  • upsert_user_from_oidc writes the claim hint when both are non-empty,
    falls back to synthetic_name_from_email otherwise. Subsequent JIT
    runs (the ON CONFLICT DO UPDATE branch) refresh only email +
    updated_at - they do NOT overwrite first_name / last_name, so a tenant
    admin or the user's own future /profile screen edit is never silently
    reverted on next login.

Test surface: all 7 place_bunyip_user call sites in
tests/bunyip_login.rs grow None, None for the two new claim args.
Existing synthetic-name tests in service.rs unchanged - they still cover
the fallback path, which fires when both hints are None or empty.

just pre-commit green (fmt + clippy -D warnings + workspace compile

  • workspace unit + doc).

#BUNYIP-141
#BUNYIP-103

Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com

Third slice of BUNYIP-103, mokosh-server half. Bunyip's /oauth2/userinfo now emits given_name + family_name standard OIDC claims when the at+jwt's scope set carries `profile` AND the user has filled them in on bunyip (BUNYIP-139 + BUNYIP-140). Wire those claims through to the JIT path so a bunyip-provisioned user lands in mokosh-server with their real name on first sight instead of `synthetic_name_from_email`'s email-local-part placeholder. - `oidc_rs::UserInfo` adds optional `given_name` / `family_name` / `phone_number` (the third unused by mokosh today but pinned for the next env change). NULL columns serialize as ABSENT per BUNYIP-140, so `Option<String>` is the right shape for every branch. - `ensure_user_from_bunyip` (middleware) reads them off the same userinfo round-trip that already fetches email + email_verified. - `place_bunyip_user` adds two args threading the hints to `upsert_user_from_oidc`. Suppressed clippy::too_many_arguments locally since bundling these into a synthetic struct would force every test call site (7 of them) to construct that struct from the same fields. - `upsert_user_from_oidc` writes the claim hint when both are non-empty, falls back to `synthetic_name_from_email` otherwise. Subsequent JIT runs (the ON CONFLICT DO UPDATE branch) refresh only email + updated_at - they do NOT overwrite first_name / last_name, so a tenant admin or the user's own future /profile screen edit is never silently reverted on next login. Test surface: all 7 `place_bunyip_user` call sites in tests/bunyip_login.rs grow None, None for the two new claim args. Existing synthetic-name tests in service.rs unchanged - they still cover the fallback path, which fires when both hints are None or empty. `just pre-commit` green (fmt + clippy -D warnings + workspace compile + workspace unit + doc). #BUNYIP-141 #BUNYIP-103 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
feat(jit): consume bunyip given_name/family_name claims (BUNYIP-141)
Some checks failed
Create release / Create release from merged PR (pull_request) Successful in 2s
E2E / Playwright against staging (pull_request) Failing after 39s
Check / fmt + clippy + compile + unit/doc tests (pull_request) Successful in 1m49s
Integration / integration tests (pull_request) Successful in 6m59s
3616ce4be6
Third slice of BUNYIP-103, mokosh-server half. Bunyip's /oauth2/userinfo
now emits given_name + family_name standard OIDC claims when the at+jwt's
scope set carries `profile` AND the user has filled them in on bunyip
(BUNYIP-139 + BUNYIP-140). Wire those claims through to the JIT path so
a bunyip-provisioned user lands in mokosh-server with their real name on
first sight instead of `synthetic_name_from_email`'s email-local-part
placeholder.

- `oidc_rs::UserInfo` adds optional `given_name` / `family_name` /
  `phone_number` (the third unused by mokosh today but pinned for the
  next env change). NULL columns serialize as ABSENT per BUNYIP-140, so
  `Option<String>` is the right shape for every branch.
- `ensure_user_from_bunyip` (middleware) reads them off the same
  userinfo round-trip that already fetches email + email_verified.
- `place_bunyip_user` adds two args threading the hints to
  `upsert_user_from_oidc`. Suppressed clippy::too_many_arguments locally
  since bundling these into a synthetic struct would force every test
  call site (7 of them) to construct that struct from the same fields.
- `upsert_user_from_oidc` writes the claim hint when both are non-empty,
  falls back to `synthetic_name_from_email` otherwise. Subsequent JIT
  runs (the ON CONFLICT DO UPDATE branch) refresh only email +
  updated_at - they do NOT overwrite first_name / last_name, so a tenant
  admin or the user's own future /profile screen edit is never silently
  reverted on next login.

Test surface: all 7 `place_bunyip_user` call sites in
tests/bunyip_login.rs grow None, None for the two new claim args.
Existing synthetic-name tests in service.rs unchanged - they still cover
the fallback path, which fires when both hints are None or empty.

`just pre-commit` green (fmt + clippy -D warnings + workspace compile
+ workspace unit + doc).

#BUNYIP-141
#BUNYIP-103

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
YousifShkara deleted branch feat/bunyip-141-jit-consume-name-claims 2026-06-21 09:43:59 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!327
No description provided.