<#7723 feat(runs): implement IdentityService.UserI...
# flyte-github
a
#7723 feat(runs): implement IdentityService.UserInfo from forwarded auth headers Pull request opened by pingsutw Tracking issue Why are the changes needed?
IdentityService.UserInfo
was a stub carrying a
TODO: Wire with real auth
, so it returned an empty
UserInfoResponse
to every caller.
flyte whoami
calls exactly this RPC and prints the response verbatim, so it printed an empty record no matter who ran it. The runs service already resolves the caller's identity for run attribution (
executed_by
), from the auth headers the proxy/LB forwards.
UserInfo
simply wasn't using it. What changes were proposed in this pull request? Implement
UserInfo
on top of the identity path that already exists, rather than adding a second one: 1.
identityFromHeaders
over the configured proxy-forwarded headers — the ALB claims JWT (
X-Amzn-Oidc-Data
), a plain subject header (
X-Amzn-Oidc-Identity
/
X-Auth-Request-User
), or an
Authorization: Bearer
token. 2.
identityEnricher.enrich
on the Bearer path, where the access token carries only a subject and name/email come from the OIDC userinfo endpoint. 3. Map the resulting
common.User
onto the OIDC-shaped
UserInfoResponse
. Because both
UserInfo
and
CreateRun
now read the same resolver, whoami and a run's
executed_by
cannot disagree about who someone is.
NewIdentityService
now takes the same three identity settings
NewRunService
does (auth-server base URL,
trustForwardedIdentityHeaders
,
identityHeaders
);
runs/setup.go
passes them from config. Behaviour change worth calling out:
UserInfo
returns
Unauthenticated
when the request carries no identity, or when
trustForwardedIdentityHeaders
is off (the caller cannot be established at all). Previously it returned an empty response. This makes
flyte whoami
report not-logged-in rather than printing
{}
.
name
is derived from first/last since
UserSpec
has no full-name field. How was this patch tested? Screenshot 2026-07-29 at 9 52 00 AM Unit tests (
runs/service/identity_service_test.go
) — 14 cases covering each header path (ALB claims JWT, ALB subject-only, oauth2-proxy plain values, Bearer), both unauthenticated cases (no headers, malformed bearer), untrusted-headers rejection, userinfo enrichment (including that userinfo's subject wins over the token's), graceful degradation when userinfo is down, and the name/handle/photo field mapping.
Copy code
$ go test ./runs/service/ -run 'TestIdentityService|TestUserInfoFromUser'
ok  	github.com/flyteorg/flyte/v2/runs/service	7.532s     # all 14 pass

$ go test ./runs/...        # full package, all green
$ go vet ./runs/...         # clean (one pre-existing warning in run_service_test.go, untouched)
End-to-end against the real CLI. I mounted the handler locally behind a shim that injects the ALB header the way
authenticate-oidc
does, and pointed
flyte whoami
at it:
Copy code
$ flyte --endpoint localhost:8099 --insecure whoami
{
  "subject": "00u3ipl8rr92YyW525d7",
  "name": "Kevin Su",
  "givenName": "Kevin",
  "familyName": "Su",
  "email": "kevin@union.ai"
}
And with no identity forwarded:
Copy code
$ flyte --endpoint localhost:8098 --insecure whoami
ConnectError: no authenticated identity on request
Not tested against a deployed cluster — that needs an image build/rollout. Labels added Setup process Screenshots Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. Related PRs Builds on the identity resolution added in #7547. Stack Docs link flyteorg/flyte