<#7507 feat(runs): serve external OAuth2 authoriza...
# flyte-github
a
#7507 feat(runs): serve external OAuth2 authorization-server metadata Pull request opened by pingsutw Tracking issue Related to #6998 Why are the changes needed? The v2 runs service exposes
flyteidl2.auth.AuthMetadataService
, but
GetOAuth2Metadata
is an unimplemented stub (returns `Unimplemented`/501), and there is no
/.well-known/oauth-authorization-server
HTTP route. As a result, OAuth2/OIDC discovery clients (flyte-sdk) and upstream proxies cannot learn which authorization server to use from a v2 deployment. This is needed when a deployment fronts its API with an external identity provider (e.g. Okta) — for example when an ALB validates Okta-issued JWTs in front of the API. Clients that discover auth at the deployment host must be pointed at the external IdP so they obtain tokens the upstream actually accepts. What changes were proposed in this pull request? Implement OAuth2 authorization-server metadata in the runs service by proxying an external authorization server's metadata document: •
runs/service/auth_metadata_service.go
— implement `GetOAuth2Metadata`: when an external auth server is configured, fetch its
.well-known/oauth-authorization-server
(with retry) and return it. Unknown fields are discarded (
protojson
with
DiscardUnknown
) so real servers like Okta — which return many extra metadata fields — parse cleanly. When not configured, it returns
Unimplemented
. Also adds
OAuth2MetadataHTTPHandler
, which serves the document at the RFC 8414 well-known path as proto3 JSON. •
runs/setup.go
— pass the new config into
NewAuthMetadataService
and mount
GET /.well-known/oauth-authorization-server
on the mux. •
runs/config/config.go
— add
AuthMetadataConfig
(
externalAuthServerBaseUrl
,
externalMetadataUrl
,
retryAttempts
,
retryDelay
) under the
runs
config section. The external-fetch/unmarshal/retry logic is adapted from #6998; this PR ports just the metadata-serving slice (no token issuance / cookie / middleware stack). How was this patch tested? Unit tests in `runs/service/auth_metadata_service_test.go`: • not-configured →
Unimplemented
(RPC) /
501
(HTTP) • external proxy returns the upstream document, including snake_case + extra fields (Okta-shaped) via
DiscardUnknown
• custom metadata path resolution • upstream
5xx
→
Unavailable
• HTTP handler returns
200
with camelCase proto3 JSON
go build ./runs/...
,
go vet
, and
gofmt
clean. Labels added Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. flyteorg/flyte