Skip to content

fix(auth): derive SSO display name from email local-part#23

Open
hunzlahmalik wants to merge 1 commit into
foss-mainfrom
fix/sso-display-name-from-email-local-part
Open

fix(auth): derive SSO display name from email local-part#23
hunzlahmalik wants to merge 1 commit into
foss-mainfrom
fix/sso-display-name-from-email-local-part

Conversation

@hunzlahmalik
Copy link
Copy Markdown

Summary

  • Drop the x-auth-request-user header read in the ForwardAuth middleware — oauth2-proxy was putting the Cognito sub UUID into that header, so newly-provisioned SSO users landed with a UUID (e.g. 892ae5ac-0021-…) as their profile.fullname.
  • Use the email local-part as the display name. The middleware already fell back to this value when the header was absent; we're promoting that fallback to the only source.
  • Update the two x-auth-request-auto-register-* tests: drop the now-unused header from the request maps, and add an explicit assertion that :fullname equals the email local-part.

Existing profiles with UUID :fullname are not auto-corrected — the middleware does not re-sync the field on subsequent logins. A backfill is out of scope here.

Test plan

  • pnpm run test from backend/ passes (focused: backend-tests.http-middleware-test)
  • Devstack end-to-end: a fresh Cognito user whose cognito:username is the bare sub UUID lands at https://foss-design.local.moneta.dev with profile.fullname = email local-part, not the UUID
  • SELECT email, fullname FROM profile ORDER BY created_at DESC LIMIT 5; reflects the new behavior

🤖 Generated with Claude Code

oauth2-proxy was putting the Cognito sub UUID into x-auth-request-user
instead of a human-readable username, so newly-provisioned SSO users
landed with a UUID as their profile fullname. Drop the header read in
the ForwardAuth middleware and use the email local-part instead —
the same value both apps already fell back to when the header was
absent; we're promoting that fallback to the only source.

Existing profiles with UUID fullnames are not auto-corrected: the
middleware does not re-sync :fullname on subsequent logins.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant