[Feature Request] Support OAuth2 client credentials as an auth mode for Connection

Abierto
#701 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
38/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
go

Línea de trabajo

Start with api/v1alpha1/connection_types.go and the Connection and ClusterConnection connection-building paths, then read the existing API-key Secret rotation handling. Check how worker pods receive connection credentials and how their SDK clients are configured; the issue leaves worker support as an open design choice. Done means OAuth2 client credentials can be configured, exchanged and refreshed for the supported connection paths, with validation and tests covering Secret changes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement
Is your feature request related to a problem? Please describe.

Connection / ClusterConnection currently support only static credentials: mutualTLSSecretRef (client cert/key) or apiKeySecretRef (bearer token), which are mutually exclusive (see api/v1alpha1/connection_types.go, AuthMode: TLS, API_KEY, NO_CREDENTIALS).

There is no way to authenticate with the OAuth2 client credentials grant (client ID + client secret exchanged for a short-lived access token at a token endpoint). This is a common setup for Temporal clusters (self-hosted, or behind an authenticating gateway/IdP such as Keycloak, Auth0, Okta, Entra ID) whose authorizer expects a JWT.

Today, users in that situation have no supported way to use the controller, because:

  • The controller's own Temporal client cannot fetch/refresh OAuth2 tokens.
  • Worker pods only receive the static credentials from the Connection (API key via TEMPORAL_API_KEY, or a mounted mTLS cert), so they can't obtain tokens either.
  • Pasting a token into apiKeySecretRef doesn't work, since access tokens expire and nothing refreshes them.
Describe the solution you'd like

Add a new auth mode (e.g. oauth2ClientCredentials) to ConnectionSpec, alongside mutualTLSSecretRef / apiKeySecretRef, and mutually exclusive with them (extend the existing CEL validation). Sketch:

apiVersion: temporal.io/v1alpha1
kind: Connection
metadata:
  name: my-temporal
spec:
  hostPort: "temporal.example.com:7233"
  oauth2ClientCredentials:
    tokenURL: https://idp.example.com/oauth2/token
    scopes: ["temporal"]
    audience: temporal-api          # optional, for IdPs that need it
    clientSecretRef:                # Secret with client_id + client_secret keys
      name: temporal-oauth2-client

Behavior:

  1. Controller connection: build the Temporal client with a token source based on golang.org/x/oauth2/clientcredentials (already an indirect dependency), wrapped in client.NewAPIKeyDynamicCredentials (or equivalent) so tokens refresh automatically, and invalidate/reload when the referenced Secret changes (the pool already handles API-key Secret rotation).
  2. Worker pods: how the credentials reach workers needs a decision. Options: inject client_id/client_secret/tokenURL/scopes as env vars so the worker's SDK client can build its own token source (e.g. via envconfig), or document that only the controller connection is supported initially.

This should compose with the separate controller/worker credentials ask in #578 so the controller can use OAuth2 client credentials while workers use something with narrower access. It also relates to the other proposed auth modes (#515 Kubernetes service account tokens, #449 file-based API keys, #654 mTLS + bearer).

Describe alternatives you've considered
  • Placing an authenticating gateway/sidecar in front of Temporal and pointing hostPort at it. This only covers the controller's connection and adds operational overhead; worker pods would still need their own handling.
  • Using a static API key / mTLS, which isn't possible when the cluster's authorizer requires IdP-issued JWTs.
Additional context

Current behavior verified against the code and docs (docs/configuration.md, docs/cluster-connection.md): no OAuth2 handling exists in the controller, and there are no existing issues for it.

Lenguaje dominante
Go
Estrellas
204
Forks
88
Merge medio
1 d 2 h
PR fusionados (30 d)
10

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de temporalio/temporal-worker-controller

Todos los issues de temporalio/temporal-worker-controller

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.