Skip to content

LookoutUI: configure displayname#4795

Merged
d2burkhalter merged 4 commits intoarmadaproject:masterfrom
d2burkhalter:fix/configure-displayname
Apr 20, 2026
Merged

LookoutUI: configure displayname#4795
d2burkhalter merged 4 commits intoarmadaproject:masterfrom
d2burkhalter:fix/configure-displayname

Conversation

@d2burkhalter
Copy link
Copy Markdown
Collaborator

What type of PR is this?

This PR allows operators to configure which oidc claim is used to display a username

What this PR does / why we need it

Currently the username is set to the sub claim which is not always human readable for example when doing local development using authentication with Keycloak
Default:
Screenshot 2026-03-24 at 4 11 45 PM
With uiConfig.oidc.displayNameClaim=name:
Screenshot 2026-03-24 at 4 10 52 PM

Special notes for your reviewer

Signed-off-by: David.Burkhalter <d2.burkhalter@gmail.com>
…playname

Signed-off-by: David.Burkhalter <d2.burkhalter@gmail.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 24, 2026

Greptile Summary

This PR allows operators to configure which OIDC claim is used to display the username in LookoutUI (defaulting to sub), making local development with Keycloak more ergonomic. It refactors the anonymous OIDC struct in Go into a named OidcConfig type, adds displayNameClaim to both the Go and TypeScript config types, and reads the claim in the useUsername hook with a proper string-type guard and a console.warn fallback when the claim is absent or non-string.

Confidence Score: 5/5

Safe to merge — all previous review concerns are addressed and no new issues introduced.

All previously flagged concerns (type narrowness, silent fallback, YAML comment) are addressed in this revision. The implementation follows established codebase patterns (module-level getConfig() is used in 29 other files). No new logic or security issues found.

No files require special attention.

Important Files Changed

Filename Overview
internal/lookoutui/src/oidcAuth/hooks.ts Reads displayNameClaim from config, validates the profile value is a string, warns and falls back to sub if not — well-implemented.
internal/lookout/configuration/types.go Extracts the inline anonymous OIDC struct into a named OidcConfig type and adds optional DisplayNameClaim *string field with clear documentation.
internal/lookoutui/src/config/types.ts Adds displayNameClaim?: string to OidcConfig interface — typed as plain string to allow custom OIDC claims, matching the Go side.
_local/lookout/config-auth.yaml Adds displayNameClaim: "name" to the local dev Keycloak config with a clear, accurate comment.

Sequence Diagram

sequenceDiagram
    participant Op as Operator Config
    participant Go as Go UIConfig (types.go)
    participant TS as TypeScript OidcConfig (types.ts)
    participant Hook as useUsername hook (hooks.ts)
    participant OIDC as OIDC Provider

    Op->>Go: displayNameClaim: "name"
    Go->>TS: JSON: { displayNameClaim: "name" }
    Hook->>OIDC: getUser()
    OIDC-->>Hook: user.profile { sub, name, ... }
    Hook->>Hook: config.oidc.displayNameClaim = "name"
    Hook->>Hook: profile["name"] === string? setUsername("name")
    Hook->>Hook: else console.warn + setUsername(sub)
Loading

Reviews (3): Last reviewed commit: "Merge branch 'master' into fix/configure..." | Re-trigger Greptile

Comment thread internal/lookoutui/src/config/types.ts Outdated
Comment thread internal/lookoutui/src/oidcAuth/hooks.ts
Comment thread _local/lookout/config-auth.yaml Outdated
Signed-off-by: David.Burkhalter <d2.burkhalter@gmail.com>
@d2burkhalter d2burkhalter enabled auto-merge (squash) April 20, 2026 16:45
@d2burkhalter d2burkhalter merged commit 9d16c62 into armadaproject:master Apr 20, 2026
17 checks passed
@d2burkhalter d2burkhalter deleted the fix/configure-displayname branch April 20, 2026 16:58
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.

3 participants