UI & API Authentication
Pilot supports OAuth2/OIDC authentication to restrict access to the dashboard and API. When enabled, users must authenticate through a configured identity provider before accessing Pilot.
Note: This page covers authentication for the Pilot UI and API. For Kafka broker authentication, see SASL and OAuth for Kafka.
Supported Providers
| Provider | Slug | Notes |
|---|---|---|
| Microsoft Entra ID | entraid | Supports tenant-based URL shortcuts |
google | Google Workspace / Cloud Identity | |
| GitHub | github | GitHub OAuth Apps |
| OpenID Connect | oidc | Any standards-compliant OIDC provider (Keycloak, ADFS, Okta, Auth0) |
Quick Start
Entra ID (Recommended for Enterprise)
Entra ID has a convenience shortcut - set AUTH_ENTRAID_TENANT and Pilot auto-derives the auth, token, and issuer URLs:
AUTH_ENTRAID_ENABLED=true
AUTH_ENTRAID_TENANT=your-tenant-id
AUTH_ENTRAID_CLIENT_ID=your-app-registration-client-id
AUTH_ENTRAID_CLIENT_SECRET=your-client-secret
AUTH_COOKIE_SECRET=random-32-char-secretAUTH_GOOGLE_ENABLED=true
AUTH_GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
AUTH_GOOGLE_CLIENT_SECRET=your-client-secret
AUTH_GOOGLE_AUTH_URL=https://accounts.google.com/o/oauth2/v2/auth
AUTH_GOOGLE_TOKEN_URL=https://oauth2.googleapis.com/token
AUTH_GOOGLE_API_URL=https://openidconnect.googleapis.com/v1/userinfo
AUTH_COOKIE_SECRET=random-32-char-secretGoogle access tokens are opaque. Leave AUTH_GOOGLE_ISSUER unset if API clients (MCP, CI)
send Google tokens: setting it turns off bearer auth for them. See
Bearer Token Validation.
GitHub
AUTH_GITHUB_ENABLED=true
AUTH_GITHUB_CLIENT_ID=your-github-oauth-app-client-id
AUTH_GITHUB_CLIENT_SECRET=your-client-secret
AUTH_GITHUB_AUTH_URL=https://github.com/login/oauth/authorize
AUTH_GITHUB_TOKEN_URL=https://github.com/login/oauth/access_token
AUTH_GITHUB_API_URL=https://api.github.com/user
AUTH_COOKIE_SECRET=random-32-char-secretOpenID Connect (Keycloak, ADFS, Okta, Auth0)
The oidc provider is vendor-neutral - point it at any standards-compliant OIDC issuer. Keycloak:
AUTH_OIDC_ENABLED=true
AUTH_OIDC_NAME=Keycloak
AUTH_OIDC_CLIENT_ID=pilot
AUTH_OIDC_CLIENT_SECRET=your-client-secret
AUTH_OIDC_AUTH_URL=https://keycloak.example.com/realms/your-realm/protocol/openid-connect/auth
AUTH_OIDC_TOKEN_URL=https://keycloak.example.com/realms/your-realm/protocol/openid-connect/token
AUTH_OIDC_API_URL=https://keycloak.example.com/realms/your-realm/protocol/openid-connect/userinfo
AUTH_OIDC_ISSUER=https://keycloak.example.com/realms/your-realm
AUTH_COOKIE_SECRET=random-32-char-secretAUTH_OIDC_NAME sets the label on the login button. The callback URL Pilot
advertises is https://<pilot-host>/api/v1/auth/callback/oidc - register that
exact URI with your provider.
Keycloak access tokens often carry an aud of account and the client id in azp. Pilot accepts either, so no extra setting is needed for the common case. If your realm maps a dedicated resource-server audience onto Pilot’s tokens, list it explicitly:
AUTH_OIDC_ALLOWED_AUDIENCES=pilot-apiAD FS
AD FS 2016 or newer (earlier versions are WS-Federation/SAML only, which Pilot does not support):
AUTH_OIDC_ENABLED=true
AUTH_OIDC_NAME=ADFS
AUTH_OIDC_CLIENT_ID=<adfs-client-id>
AUTH_OIDC_CLIENT_SECRET=<adfs-client-secret>
AUTH_OIDC_AUTH_URL=https://adfs.example.com/adfs/oauth2/authorize
AUTH_OIDC_TOKEN_URL=https://adfs.example.com/adfs/oauth2/token
AUTH_OIDC_ISSUER=https://adfs.example.com/adfs
AUTH_COOKIE_SECRET=random-32-char-secretTake the exact issuer, authorization_endpoint, and token_endpoint values
from https://<adfs-host>/adfs/.well-known/openid-configuration; the issuer is
compared exactly. Register the AD FS application as a Server application so
it accepts a client secret in the token request body.
On AD FS 2016, also set AUTH_OIDC_USE_PKCE=false - PKCE arrived in AD FS 2019,
and older versions reject the code_verifier parameter.
AD FS claim names depend on the relying party’s issuance transform rules - there
is no built-in groups claim, and the userinfo endpoint returns only sub, so
Pilot reads claims from the id_token. Group membership commonly arrives under
roles or role (Token-Groups mapped to the Role claim type). Decode a token
and point the mapping at what your rules issue:
AUTH_OIDC_GROUPS_CLAIM=roles
AUTH_OIDC_USERNAME_CLAIM=upnSee Claim Mapping for the defaults.
Per-Provider Configuration
All providers use the same configuration pattern with the AUTH_<PROVIDER>_* prefix. Replace <PROVIDER> with ENTRAID, GOOGLE, GITHUB, or OIDC.
AUTH_<PROVIDER>_ENABLED must be present in the environment for the rest of that provider’s block to be read at all. Setting only AUTH_OIDC_CLIENT_ID, for example, configures nothing.
| Variable | Default | Description |
|---|---|---|
AUTH_<PROVIDER>_ENABLED | false | Enable this provider |
AUTH_<PROVIDER>_NAME | Auto | Display name on login page |
AUTH_<PROVIDER>_CLIENT_ID | "" | OAuth client ID |
AUTH_<PROVIDER>_CLIENT_SECRET | "" | OAuth client secret |
AUTH_<PROVIDER>_AUTH_URL | "" | Authorization endpoint |
AUTH_<PROVIDER>_TOKEN_URL | "" | Token endpoint |
AUTH_<PROVIDER>_API_URL | "" | Userinfo endpoint |
AUTH_<PROVIDER>_ISSUER | "" | OIDC issuer. Enables JWKS discovery and bearer JWT signature verification |
AUTH_<PROVIDER>_JWKS_URL | "" | JWKS endpoint. Overrides discovery from the issuer, but still requires it. Must be an absolute http/https URL; anything else is ignored |
AUTH_<PROVIDER>_JWKS_CACHE_TTL | 15m | How long fetched signing keys are cached |
AUTH_<PROVIDER>_SCOPES | openid email profile | OAuth scopes (space or comma-separated) |
AUTH_<PROVIDER>_USE_PKCE | true | Enable PKCE for authorization code flow |
AUTH_<PROVIDER>_USE_REFRESH_TOKEN | true | Enable refresh token handling |
AUTH_<PROVIDER>_ALLOW_SIGN_UP | true | Allow new users to register |
AUTH_<PROVIDER>_AUTO_LOGIN | false | Auto-redirect to provider (skip login page) |
AUTH_<PROVIDER>_USERNAME_CLAIM | "" | Claim for the session username. See Claim Mapping |
AUTH_<PROVIDER>_EMAIL_CLAIM | "" | Claim for the session email and ALLOWED_DOMAINS. See Claim Mapping |
AUTH_<PROVIDER>_GROUPS_CLAIM | "" | Claim for session groups and ALLOWED_GROUPS. See Claim Mapping |
Claim Mapping
Pilot builds the session identity (username, email, groups) from the claims the provider returns. Each field has a default chain of claim names, tried in order; the first one present with a non-empty value wins.
| Field | Variable | Default chain | Used by |
|---|---|---|---|
| Username (UPN) | AUTH_<PROVIDER>_USERNAME_CLAIM | upn, preferred_username | Session username |
AUTH_<PROVIDER>_EMAIL_CLAIM | email, preferred_username, upn | Session email, AUTH_<PROVIDER>_ALLOWED_DOMAINS | |
| Groups | AUTH_<PROVIDER>_GROUPS_CLAIM | groups, roles, role, group | Session groups, AUTH_<PROVIDER>_ALLOWED_GROUPS |
A configured claim is consulted first, with the default chain as fallback. The groups claim accepts an array or a single string; lists are never merged across claim names.
Claims come from both the userinfo response and the id_token (userinfo wins; the id_token fills in what is missing), so a provider whose userinfo returns only sub still yields a full identity. Make sure the IdP emits the claim you filter on into the token; see Access Control.
Bearer Token Validation
API clients that cannot hold a session cookie authenticate with Authorization: Bearer <token>. Pilot accepts a bearer credential in exactly two ways:
- Signed JWT - verified against the signing keys the provider publishes.
- Opaque token - presented to
AUTH_<PROVIDER>_API_URL. The response is the identity; if the provider does not answer with a claim set, the request is rejected.
A token that is neither a verifiable JWT nor accepted by the userinfo endpoint is rejected with 401.
Setting AUTH_<PROVIDER>_ISSUER turns off opaque-token bearer auth for that provider.
Opaque tokens from it are then rejected with 403 invalid audience. Browser login and
JWT bearer auth still work. GitHub publishes no issuer, so its tokens are always
checked through userinfo.
| Provider | Access token shape | Required for bearer auth |
|---|---|---|
| Entra ID | JWT (aud is api://<client-id>) | AUTH_ENTRAID_TENANT or AUTH_ENTRAID_ISSUER |
| OpenID Connect | JWT | AUTH_OIDC_ISSUER |
opaque (ya29.*) | AUTH_GOOGLE_API_URL, and AUTH_GOOGLE_ISSUER left unset | |
| GitHub | opaque (gho_*, ghp_*) | AUTH_GITHUB_API_URL |
What Is Checked on a Signed JWT
| Check | Rule |
|---|---|
| Signature | Must match a key the provider publishes at its JWKS endpoint |
| Algorithm | RS*, PS*, ES* only. none and the HMAC family are rejected |
exp | Required. A token without exp is rejected. 60s clock leeway |
nbf, iat | Validated when present, same leeway |
iss | Must match AUTH_<PROVIDER>_ISSUER. A trailing slash on either side is ignored |
aud, azp | Must name this deployment (see Audience Binding) |
Signing keys are discovered at <issuer>/.well-known/openid-configuration, cached for AUTH_<PROVIDER>_JWKS_CACHE_TTL (default 15m), and re-fetched when a token names an unknown kid, so key rotation needs no restart. Discovery and JWKS fetches will not follow a redirect to a different host.
If the signing keys cannot be fetched, Pilot keeps using the last keys for up to 30 minutes past the cache TTL. After that, bearer JWTs for that provider are rejected until the keys are reachable again.
Audience Binding
Every bearer JWT must name this deployment. Otherwise a token that the same issuer signed for another application (a shared Entra tenant, a multi-client Keycloak realm) could authenticate here.
AUTH_<PROVIDER>_ALLOWED_AUDIENCESdefaults toAUTH_<PROVIDER>_CLIENT_IDwhen it is not set. For Entra ID the default isapi://<client-id>and<client-id>.- Both
aud(a string or an array) andazpare examined. A Keycloak token whoseaudnames a resource server still authenticates whenazpis the Pilot client id; a token whoseazpnames a different application is rejected. - A token that names none of the expected audiences is rejected with
403and the messageinvalid audience. - A provider that resolves no audience at all (no client id and no allowlist) rejects every bearer JWT with
401. - Do not set
AUTH_<PROVIDER>_ALLOWED_AUDIENCESfor a provider whose bearer tokens are opaque, such as GitHub or Google. Their tokens carry no audience, so every bearer token would be rejected with403 invalid audience.
Access Control
Restrict access by organization, email domain, group, or audience:
AUTH_ENTRAID_ALLOWED_ORGANIZATIONS=your-tenant-id
AUTH_ENTRAID_ALLOWED_DOMAINS=example.com,corp.example.com
AUTH_ENTRAID_ALLOWED_GROUPS=kafka-admins,platform-team
AUTH_ENTRAID_ALLOWED_AUDIENCES=api://your-client-id| Variable | Description |
|---|---|
AUTH_<PROVIDER>_ALLOWED_ORGANIZATIONS | Allowed organizations (comma-separated) |
AUTH_<PROVIDER>_ALLOWED_DOMAINS | Allowed email domains (comma-separated) |
AUTH_<PROVIDER>_ALLOWED_GROUPS | Allowed groups (comma-separated) |
AUTH_<PROVIDER>_ALLOWED_AUDIENCES | Allowed token audiences (comma-separated). Defaults to AUTH_<PROVIDER>_CLIENT_ID (Entra ID also accepts api://<client-id>) so a bearer JWT must be minted for this deployment. |
If any filter is set, users must match at least one value in that filter to be granted access. All four filters fail closed: a token that carries no claim the filter can read (for example a domain restriction against a token with no email) is rejected, not waved through. A failed filter returns 403 with the reason (organization not allowed, email domain not allowed, group not allowed, invalid audience).
The filters run on browser login and on bearer authentication, always against claims that were verified or returned by the provider, never against values read out of an unverified token body. For a signed JWT those are the token’s own verified claims (groups, email, tid, aud); a group or domain the provider exposes only on its userinfo endpoint is not consulted, so make sure the IdP emits the claim you filter on into the token itself. PATs are not subject to these filters.
The group and domain filters read the claim names configured by AUTH_<PROVIDER>_GROUPS_CLAIM and AUTH_<PROVIDER>_EMAIL_CLAIM, falling back to the default chains described under Claim Mapping. A provider that issues groups under a name outside the default chain needs AUTH_<PROVIDER>_GROUPS_CLAIM set for ALLOWED_GROUPS to see them. For AD FS, which issues them under roles, AUTH_<PROVIDER>_GROUPS_CLAIM=roles makes the mapping explicit and consults roles ahead of any groups claim the token may also carry.
Session Settings
| Variable | Default | Description |
|---|---|---|
AUTH_COOKIE_SECRET | "" | HMAC signing key for session cookies. Required in production. Auto-generated in dev if empty. |
AUTH_COOKIE_NAME | pilot_session | Session cookie name |
AUTH_COOKIE_DOMAIN | "" | Cookie domain scope |
AUTH_COOKIE_SECURE | true | HTTPS-only cookies. Set to false for HTTP-only dev environments. |
AUTH_SESSION_TTL | 12h | Session time-to-live |
Debug Options
| Variable | Default | Description |
|---|---|---|
AUTH_DEBUG_EXPOSE_TOKENS | false | Expose raw access tokens in /api/v1/auth/me response. Never enable in production. |
API Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/v1/auth/providers | List configured OAuth providers |
GET | /api/v1/auth/login/{provider} | Initiate OAuth flow |
GET | /api/v1/auth/callback/{provider} | OAuth callback |
GET | /api/v1/auth/me | Current authenticated user |
POST | /api/v1/auth/logout | End session |
POST | /api/v1/auth/refresh | Refresh access token |
Entra ID Convenience
When AUTH_ENTRAID_TENANT is set, Pilot automatically derives:
AUTH_URL→https://login.microsoftonline.com/<tenant>/oauth2/v2.0/authorizeTOKEN_URL→https://login.microsoftonline.com/<tenant>/oauth2/v2.0/tokenISSUER→https://login.microsoftonline.com/<tenant>/v2.0API_URL→https://graph.microsoft.com/oidc/userinfoALLOWED_ORGANIZATIONS→[<tenant>](if not explicitly set)ALLOWED_AUDIENCES→[api://<client-id>, <client-id>](if not explicitly set)
You can override any of these by setting the explicit variable.
Every other provider (Google, GitHub, OIDC) also defaults ALLOWED_AUDIENCES to [<client-id>] when it is not set.
MCP OAuth
Pilot acts as the protected resource. The selected identity provider handles authorization-code login with PKCE and issues access tokens for Pilot’s MCP API. The client exchanges the code directly with that provider. Pilot does not register OAuth clients dynamically or broker tokens. Browser sessions and PAT authentication are configured separately.
Entra ID Registration
Use a tenant-specific Entra provider and separate registrations for the Pilot API resource and the public MCP client. Keep the Pilot browser-login registration and its callback for dashboard sessions.
- Register the Pilot MCP API and set its
api.requestedAccessTokenVersionto2before configuring its identifier URI. - Under Expose an API, set the Application ID URI to the exact canonical HTTPS MCP URL, such as
https://pilot.example.com/api/v1/mcp, without a trailing slash. This must equalAUTH_MCP_OAUTH_RESOURCE_URLand the client’sresourceparameter. See Microsoft’s MCP registration guidance . - Expose delegated scopes
mcp.readandmcp.writeon that API registration. Their full names append the scope name to the Application ID URI. Grant the public client those delegated permissions and obtain consent under your tenant policy. See Microsoft’s API scope configuration . - Register Codex as a public desktop client for authorization code with
S256PKCE. It needs its own client ID and a loopback redirect URI, with no client secret. See Microsoft’s authorization code flow .
Choose an HTTPS hostname your tenant allows as an identifier URI. If Entra rejects it, ask your tenant administrator. See Microsoft’s identifier URI restrictions .
Configure Pilot alongside the existing AUTH_ENTRAID_* settings:
AUTH_MCP_OAUTH_PROVIDER=entraid
AUTH_MCP_OAUTH_RESOURCE_URL=https://pilot.example.com/api/v1/mcp
AUTH_MCP_OAUTH_AUDIENCE=YOUR_API_APP_ID
AUTH_MCP_OAUTH_READ_SCOPE=https://pilot.example.com/api/v1/mcp/mcp.read
AUTH_MCP_OAUTH_WRITE_SCOPE=https://pilot.example.com/api/v1/mcp/mcp.writeUse the same canonical URL in the Codex server entry. For Entra development, expose an HTTPS endpoint with a matching registered identifier; use PAT authentication for a local HTTP endpoint.
The audience is the API registration’s application ID, not the Codex public client ID. For MCP OAuth bearer validation, AUTH_MCP_OAUTH_AUDIENCE supplies the audience requirement instead of AUTH_<PROVIDER>_ALLOWED_AUDIENCES; azp cannot substitute for aud. Pilot validates the issuer, signature, expiry, resource audience, and delegated scopes. The provider’s domain, group, and organization restrictions still apply. A read scope permits inspection; a write scope permits mutations when MCP write access is enabled, subject to Pilot’s license and safety checks.
MCP resource tokens are accepted only at /api/v1/mcp, not at other REST endpoints. Use a dedicated API registration distinct from the browser-login registration so their audiences remain separate. Dashboard cookies and PATs retain their existing endpoint access.
Codex Login and Callback
Choose a free local port, such as 4321. In your personal Codex configuration, set these top-level values before adding the server:
mcp_oauth_callback_url = "http://127.0.0.1:4321/callback"
mcp_oauth_callback_port = 4321Then add the server with the public client ID:
codex mcp add pilot --url https://pilot.example.com/api/v1/mcp \
--oauth-client-id YOUR_PUBLIC_CLIENT_IDRegister the complete callback URL printed by Codex as a public-client redirect URI in Entra. Codex can append a server-specific path suffix, so use the displayed URL exactly. It saves the callback with the client ID. See Codex OAuth configuration .
For http://127.0.0.1 redirects, Entra requires the port to match. If its portal rejects that HTTP loopback address, configure the public-client redirect through the application manifest. Do not register it as a web or SPA callback. See Microsoft’s redirect URI restrictions .
After registration, log in with the API’s delegated scope:
codex mcp login pilot --scopes https://pilot.example.com/api/v1/mcp/mcp.readRequest https://pilot.example.com/api/v1/mcp/mcp.write when the client needs mutations, which also need PILOT_MCP_WRITE_ENABLED=true. Use an OAuth server entry without bearer_token_env_var or a static Authorization header. Pilot’s dashboard callback does not receive the Codex authorization response.
Deployment Validation
- Fetch
https://pilot.example.com/.well-known/oauth-protected-resource/api/v1/mcpand the root fallback/.well-known/oauth-protected-resourcewithout credentials. Both must return JSON containing the canonical MCP resource, authorization server, and configured scopes, with no browser-login redirect. - Send an unauthenticated request to
/api/v1/mcp. Expect401and aWWW-Authenticate: Bearerchallenge containingresource_metadata. - Complete
codex mcp login pilotwith the read scope, then ask Codex to callget_cluster_overview. Verify that it works without a manually supplied PAT. - Verify that read-only access rejects mutation tools, and invalid, expired, wrong-issuer, or wrong-audience access tokens are rejected. With
PILOT_MCP_WRITE_ENABLED=true, check the audit identity for an authorized mutation in a test cluster.
Run these checks once for your deployment before you rely on OAuth access. Your identity provider must support authorization code with PKCE, public clients, JWT access tokens and the configured scopes.
Personal Access Tokens (PATs)
When authentication is enabled, any programmatic access to the Pilot API requires authentication. Personal Access Tokens provide long-lived, revocable Bearer tokens that work with every API endpoint - REST calls, CI/CD pipelines, monitoring integrations, and MCP clients alike.
How It Works
- A user authenticates via OAuth in the Pilot UI
- From the user menu, they create a PAT with a name, scope, and optional expiry
- The plaintext token (
pat_...) is shown once and must be copied immediately - The token is used as a Bearer token:
Authorization: Bearer pat_...
Only the HMAC-SHA256 hash of the token is stored - the plaintext is never persisted.
Token Scopes
| Scope | Permissions |
|---|---|
read | GET operations only (monitoring, viewing configs, browsing messages) |
write | All operations including mutations (reassignments, ACLs, quotas, etc.) |
On the MCP endpoint, scope is checked per tool rather than by HTTP method. Read-scoped PATs can call read tools. Write-scoped PATs can also execute mutations when PILOT_MCP_WRITE_ENABLED=true; this setting does not affect REST requests. License checks, safety gates, and audit logging still apply. See MCP mutation execution.
Configuration
| Variable | Default | Description |
|---|---|---|
AUTH_PAT_ENABLED | false | Enable PAT feature (requires auth to be enabled) |
AUTH_PAT_HASH_SECRET | "" | Required. HMAC-SHA256 secret for hashing tokens. Must be a stable, persistent value - PATs become invalid if this changes. |
AUTH_PAT_MAX_PER_USER | 10 | Maximum tokens per user that are neither revoked nor expired |
Important: Both
AUTH_PAT_ENABLED=trueand a non-emptyAUTH_PAT_HASH_SECRETare required for PATs to work. If the hash secret is not set, PAT endpoints will return a “not enabled” error even whenAUTH_PAT_ENABLED=true.
API Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/v1/tokens | List your tokens |
POST | /api/v1/tokens | Create a new token |
DELETE | /api/v1/tokens/{id} | Revoke a token |
Security: PAT management endpoints require an OAuth session. A PAT cannot create or revoke other PATs, preventing token-chaining.
Usage
Include the token as a Bearer token in any API request:
curl https://pilot.example.com/api/v1/cluster \
-H "Authorization: Bearer pat_your_token_here"All API endpoints accept PAT authentication - cluster info, partitions, consumer groups, proposals, ACLs, quotas, and more. See the API Reference for the full endpoint list.
Use Cases
- REST API access - authenticate any API call from scripts, tools, or applications
- CI/CD pipelines - automate Kafka operations (topic config updates, ACL management, reassignments)
- Monitoring integrations - read-only tokens for external dashboards pulling cluster metrics
- MCP clients (GitHub Copilot, Warp, Claude Desktop) - see MCP Authentication for client configuration examples
- Service accounts - long-lived access for automation tools