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

オープン
#701 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
38/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Go
スター
204
フォーク
88
平均マージ
1日 2時間
マージ済み PR(30日)
10

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

temporalio/temporal-worker-controller のほかの issue

temporalio/temporal-worker-controller の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。