Skip to content

feat: let the azure provider authenticate with a client assertion file - #2990

Open
its-ammu wants to merge 1 commit into
supabase:masterfrom
its-ammu:feat/azure-client-assertion-file
Open

its-ammu wants to merge 1 commit into
supabase:masterfrom
its-ammu:feat/azure-client-assertion-file

Conversation

@its-ammu

@its-ammu its-ammu commented Dec 4, 2026 •

Copy link
Copy Markdown

Feature request: https://github.com/orgs/supabase/discussions/54617

What

The Azure provider can now authenticate the code exchange with a client assertion read from a file, instead of a client secret.

GOTRUE_EXTERNAL_AZURE_CLIENT_ASSERTION_FILE=/var/run/secrets/tokens/azure-identity-token

When it is set:

  • The token request sends client_assertion and client_assertion_type (urn:ietf:params:oauth:client-assertion-type:jwt-bearer) in the form body, with no Basic auth header.
  • GOTRUE_EXTERNAL_AZURE_SECRET is not required. If one is still set, it is never sent.
  • The file is read on every exchange, because the platform rotates the token in it.
  • It fails closed: a missing or empty file fails the exchange, and there is no fallback to the secret.

When it is not set, nothing changes.

Why

This enables Entra workload identity federation. The Entra app trusts tokens from an external OIDC issuer, such as a Kubernetes cluster's service account issuer, so no client secret has to be stored or rotated. On AKS, EKS or GKE, the platform mounts a short-lived projected service account token. GoTrue only needs to read that file and send it as the assertion.

This complements the private_key_jwt support added in #2932–#2936. That support covers custom OIDC providers, with assertions that GoTrue signs using a key it holds. Here the platform issues the assertion, so GoTrue holds no key at all. It also applies to the built-in Azure provider, so existing users' Azure identities are unchanged. The request shape is the same as in #2936: the assertion goes in the body, with AuthStyleInParams.

How

  • OAuthProviderConfiguration gains ClientAssertionFile (client_assertion_file). Only the Azure provider uses it for now.
  • ValidateOAuthClientAssertion validates a provider the same way as ValidateOAuth, minus the secret.
  • NewAzureProvider uses that validation and clears the secret when a file is configured. GetOAuthToken adds the assertion parameters.
  • example.env documents the new variable.

Tests

  • internal/api/provider/azure_test.go:
    • with no secret configured, the exchange sends the assertion in the body, without Basic auth or client_secret;
    • a rotated file is picked up on the next exchange;
    • a leftover secret is ignored;
    • a missing file fails the exchange;
    • without a file, the secret is still required.
  • internal/conf/configuration_test.go: the env var loads, and both validations behave as expected.

go test ./internal/api/provider ./internal/conf, make static and make sec pass locally.

Verified end to end against Entra ID with a federated credential, using an AKS projected service account token. I'm happy to change the shape, for example to make it a generic per-provider option instead of Azure-only.

@its-ammu
its-ammu requested a review from a team as a code owner December 4, 2026 07:31
@its-ammu
its-ammu force-pushed the feat/azure-client-assertion-file branch from 61139e4 to d3a6e5a Compare December 4, 2026 12:29
@its-ammu
its-ammu force-pushed the feat/azure-client-assertion-file branch from d3a6e5a to ed4d75a Compare December 4, 2026 12:33

This branch has not been deployed

No deployments
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.

1 participant