Skip to content

feat: show OIDC full name and avatar in the user menu - #318

Open
wendelino wants to merge 1 commit into
rustfs:mainfrom
wendelino:feat/oidc-profile-display
Open

wendelino wants to merge 1 commit into
rustfs:mainfrom
wendelino:feat/oidc-profile-display

Conversation

@wendelino

Copy link
Copy Markdown

Pull Request

Description

After an OIDC login the user menu showed the internal identity hash instead of the user's name, and always the theme placeholder avatar. Server PR rustfs/rustfs#9600 now returns display_name and picture (from the ID token or the provider's UserInfo endpoint) on /accountinfo and /account/info. This PR uses them:

  • The user menu name resolves display_name, then the existing username, email and access key fallbacks (resolveAccountMenuName).
  • The IdP avatar replaces the theme placeholder (resolveAccountAvatarUrl). It is accepted only as an absolute https URL, loads with referrerPolicy="no-referrer", and the existing onError fallback switches back to the theme avatar.
  • The profile page keeps resolveAccountDisplayName, so its "Username" label still shows the username.
  • AccountInfo in hooks/use-account.ts gains the two optional fields.

Without the server change the fields are absent and the menu behaves exactly as before.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test improvements
  • Security fix

Testing

  • Unit tests added/updated
  • Manual testing completed

Tested commit e7cb41c with pnpm 12.3.4 and Node 24:

pnpm install --frozen-lockfile
pnpm type-check   # passes
pnpm lint         # passes (changed files)
pnpm format:check # passes
pnpm test:run     # 1273 passed, 0 failed

New tests in tests/lib/account-display.test.ts cover the full-name preference, the blank-name fallback, and the avatar URL filter (rejects missing, http:, javascript:, relative and malformed values). The source-pattern tests in tests/lib/account-surface.test.js and tests/lib/ui-layout-source.test.js were updated to the new resolver names and now also assert the avatar fallback and no-referrer.

Not done: manual testing against a running server with an OIDC provider.

Checklist

  • Code follows the project's style guidelines
  • Self-review completed
  • TypeScript types are properly defined
  • All commit messages are in English (Conventional Commits)
  • All existing tests pass
  • No new dependencies added, or they are justified

Related Issues

Depends on rustfs/rustfs#9600 for the data; safe to merge independently.

Screenshots (if applicable)

Not included yet: this needs a server build with rustfs/rustfs#9600 and a configured OIDC provider. I will add before/after screenshots of the user menu once that environment is available.

Additional Notes

Loading the avatar sends a request from the browser to the IdP's image host; no-referrer keeps the console URL out of that request.


🤖 Generated with Claude Code

The server now reports display_name and picture for OIDC sessions (from
the ID token or the provider's UserInfo endpoint). Use them in the user
menu: the full name comes first, then the existing username, email and
access key fallbacks, and the IdP avatar replaces the theme placeholder.

The avatar is accepted only as an absolute https URL, loads without a
referrer, and falls back to the theme avatar when it fails to load. The
profile page keeps showing the username under its "Username" label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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