---
title: "Users, roles and SSO"
description: "Sign in with local users or your OIDC provider, the three roles, team scoping, machine tokens for automation, and retiring the bootstrap admin token."
url: "https://opod.io/docs/control-plane-security/authentication/"
markdown_url: "https://opod.io/docs/control-plane-security/authentication.md"
section: "Security"
last_updated: "2026-11-12"
---

# Users, roles and SSO

> Sign in with local users or your OIDC provider, the three roles, team scoping, machine tokens for automation, and retiring the bootstrap admin token.

Every `/api/v1` call and the console's event stream need `Authorization: Bearer <token>`. A token is one of: a session from a local sign-in, a session from OIDC, a machine token (`cpt-…`), or the bootstrap admin token. Request bodies never carry credentials for these routes, and a URL never does.

## In short

Right after install there is one way in: the bootstrap admin token from the chart's Secret. Give each person their own sign-in instead, either a local user or your company's SSO (OIDC), and give each program a machine token with one narrow scope. Each person gets a role (`viewer`, `operator` or `admin`), and a team if they should see only their team's endpoints. Connecting OIDC retires the shared token for people.

## When you need it

- A second person needs access: create a local user, or connect OIDC.
- Your company signs in with Okta, Entra ID, Google, Keycloak or another OIDC provider.
- A team must see and change only its own endpoints: give its users a `team`.
- A CI job must deploy plans or mint keys: give it a machine token with `plans:write` or `tokens:write`.
- Doctor's `identity` row is red.

## Do it

1. **Read the bootstrap admin token**

   ```bash
   kubectl -n opodcp get secret opodcp-admin -o jsonpath='{.data.token}' | base64 -d > admin.token
   H="Authorization: Bearer $(cat admin.token)"
   ```

   The Secret is `<fullname>-admin`. A release whose name contains `opodcp` uses that name as the full name, so release `opodcp` gives `opodcp-admin`; any other release gets `<release>-opodcp-admin`, for example `prod-opodcp-admin`.

2. **Create a local user**

   ```bash
   curl -s -H "$H" -H 'Content-Type: application/json' -X POST https://cp.example.com/api/v1/users \
     -d '{"name":"alice","password":"<a long password>","role":"operator","team":"search"}'
   ```

   Alice now signs in on the console with that name and password.

3. **Connect OIDC**

   Register the redirect URL `https://cp.example.com/api/v1/auth/oidc/callback` with your provider. Then save the **identity** settings on the Connectors page, for example:

   ```text
   OPODCP_OIDC_ISSUER        https://login.example.com/realms/acme
   OPODCP_OIDC_CLIENT_ID     opod
   OPODCP_OIDC_CLIENT_SECRET <client secret>
   OPODCP_OIDC_ROLE_MAP      opod-admins=admin,ml-ops=operator
   OPODCP_PUBLIC_URL         https://cp.example.com
   ```

   On 0.2.1 these are chart values instead: `ports.identity.oidcIssuer`, `.oidcClientId`, `.oidcClientSecretRef`, `.oidcRoleMap`, `.oidcDefaultRole` and `.publicUrl`.

4. **Give automation a machine token**

   Machine tokens are new in 0.3.0.

   ```bash
   opodcp token create --scope plans:write --expires-in 2160h --cp https://cp.example.com --token "$(cat admin.token)" ci-deployer
   ```

   The token (`cpt-…`) is printed once. Store it in your CI's secret store.

## Check it worked

```bash
curl -s -H 'Content-Type: application/json' -X POST https://cp.example.com/api/v1/login \
  -d '{"name":"alice","password":"<a long password>"}' | jq '{name, role, team}'
# {"name":"alice","role":"operator","team":"search"}
curl -s https://cp.example.com/api/v1/auth/methods
```

A good answer: the login returns a token with the role and team you set, and `auth/methods` lists OIDC once it is connected. The console offers **Sign in with SSO**, and the account menu shows the user's name instead of `static-admin`. Doctor's `identity` row turns green once OIDC is connected.

## If it fails

| Symptom                                                             | Cause                                                                          | Fix                                                               |
| ------------------------------------------------------------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------- |
| `401` on every call                                                 | the token is wrong or expired, or it is sent in the URL                        | send `Authorization: Bearer <token>`; sign in again               |
| `401 credential_in_url`                                             | `?token=` in a URL                                                             | send the header; for `/events` and downloads, use a stream ticket |
| `403`                                                               | the role is too low, or the object belongs to another team                     | an operator or admin role; an unscoped user for cross-team work   |
| `429` on sign-in, with `Retry-After`                                | more than ten attempts at once from one address                                | wait; behind a proxy, list it in `api.trustedProxies`             |
| `409` on deleting a user                                            | it is the last admin                                                           | create another admin first                                        |
| SSO redirects fail                                                  | the redirect URL or `OPODCP_PUBLIC_URL` does not match what the provider has   | register exactly `<public URL>/api/v1/auth/oidc/callback`         |
| Everyone signs in as `viewer`                                       | no group in `OPODCP_OIDC_ROLE_MAP` matches, or the groups are in another claim | fix the map; set `OPODCP_OIDC_ROLE_CLAIM`                         |
| The control plane does not start after you cleared the admin Secret | it needs `OPODCP_ADMIN_TOKEN` or `OPODCP_BOOTSTRAP_ADMIN_PASSWORD`             | restore the Secret (see the warning below)                        |

## Roles

| Role       | May                                                                                                                                            |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `viewer`   | read everything the caller's team may see                                                                                                      |
| `operator` | create, change and delete endpoints, plans, rollouts, runs, keys, models, versions and jobs; acknowledge alerts                                |
| `admin`    | users, machine tokens, the licence, connectors, alert rules, team quotas, model approval, machine actions, backup and restore, the audit chain |

Every route declares its minimum role. `GET /api/v1/openapi.json` lists each operation with its role (`x-opod-role`) and scope (`x-opod-scope`).

## Local users

```bash
curl -s -H "$H" -H 'Content-Type: application/json' -X POST https://cp.example.com/api/v1/users \
  -d '{"name":"alice","password":"…","role":"operator","team":"search"}'
curl -s -H 'Content-Type: application/json' -X POST https://cp.example.com/api/v1/login \
  -d '{"name":"alice","password":"…"}'          # → { token, name, role, team, expiresAt }
```

Passwords are stored as bcrypt hashes; sessions are server-side and last 24 h, and `POST /api/v1/logout` ends one. `DELETE /api/v1/users/{id}` also ends the user's sessions, and the last admin cannot be deleted (`409`). The console's **Teams & quotas** page manages users.

**Sign-in is rate limited** per client address: ten attempts at once, then one every six seconds; over it, `429` with `Retry-After`. A refused credential writes an `auth.login_failed` audit row with the name tried and the address, never the password. An unknown user costs the same hash comparison as a known one, and the answer is identical. Behind an Ingress, list the proxy's CIDRs in `api.trustedProxies`, so the client address comes from `X-Forwarded-For` of those peers only.

## Single sign-on (OIDC)

Save these on the Connectors page (**identity**). On 0.2.1 they are chart values under `ports.identity` (`oidcIssuer`, `oidcClientId`, `oidcClientSecretRef`, `oidcRoleMap`, `oidcDefaultRole`, `publicUrl`). Any OIDC issuer works; sign-in uses the authorization code flow with PKCE.

| Setting                     | Meaning                                                                                |
| --------------------------- | -------------------------------------------------------------------------------------- |
| `OPODCP_OIDC_ISSUER`        | the issuer URL; its `/.well-known/openid-configuration` must be reachable from the pod |
| `OPODCP_OIDC_CLIENT_ID`     | the client id                                                                          |
| `OPODCP_OIDC_CLIENT_SECRET` | stored sealed                                                                          |
| `OPODCP_OIDC_ROLE_MAP`      | `group=role,…`, for example `opod-admins=admin,ml-ops=operator`                        |
| `OPODCP_OIDC_DEFAULT_ROLE`  | the role of a user no group maps; default `viewer`                                     |
| `OPODCP_PUBLIC_URL`         | the console's URL as browsers see it, for redirects                                    |

Through `extraEnv`: `OPODCP_OIDC_ROLE_CLAIM` (the claim carrying groups; default `groups`), `OPODCP_OIDC_TEAM_CLAIM` (the claim naming the user's team; unset = unscoped), `OPODCP_OIDC_REDIRECT_URL` (default `<public URL>/api/v1/auth/oidc/callback`). Register that redirect URL with your provider.

What to set up at your provider — the client, the groups claim in the ID token for Keycloak, Okta and Entra ID, and what Verify checks — is in [Connector setup → OIDC](https://opod.io/docs/control-plane-operate/connector-setup/#single-sign-on-oidc).

The console then offers **Sign in with SSO**. `GET /api/v1/auth/methods` says which methods are on. Local users keep working beside OIDC.

## Retire the bootstrap token

The chart's `admin.token` is a bootstrap credential. Every action taken with it is audited as the same pseudo-user, `static-admin`, so the audit chain stays intact but says nothing about who acted. The doctor's `identity` row stays red while it works:

- `BOOTSTRAP: the shared admin token is the only way in` — expected right after install.
- `SHARED ROOT BESIDE REAL USERS` — people exist and the shared token still works.

**Connecting OIDC retires the token**: once an issuer is configured, the token no longer signs anyone in, and SSO is the way in. Without OIDC the token keeps working beside your local users, so that a mistyped password or a new colleague never locks anyone out, and the doctor row stays red to say so.

> **Do not just empty admin.token**
>
> Emptying `admin.token` and upgrading does not remove the token: the chart keeps the one it generated in Secret `<release>-opodcp-admin`. Clearing the `token` item in that Secret stops the control plane from starting at all (`set OPODCP_ADMIN_TOKEN or OPODCP_BOOTSTRAP_ADMIN_PASSWORD`), unless `OPODCP_BOOTSTRAP_ADMIN_PASSWORD` is set through `extraEnv`. Connect OIDC instead, and keep the Secret out of reach.

`OPODCP_BOOTSTRAP_ADMIN_PASSWORD` (through `extraEnv`) makes the control plane create a local user `admin` with that password at first start. It does not retire the token either: it is the same bootstrap credential in a second form.

Give automation a machine token with the narrowest scope, never a key to everything.

## Teams

A user created with a `team`, or an OIDC user whose team claim names one, sees only that team's rows: endpoints, runs, jobs, keys, policies, alerts, audit rows, usage and the team's own quota. Another team's object answers `403` with a message that names neither the object nor its team. An endpoint a scoped operator creates lands in their team. Admins and users with no team are unscoped.

Team names are stored trimmed and lower-case, and an absent one is `default`. A team's GPU quota (`PUT /api/v1/team-quotas`, admin) is judged on new placements only.

## Machine tokens

Machine tokens are new in 0.3.0. A machine token is a program's credential where a person would sign in. Every token reads as **viewer**; its one scope may add one narrow write:

| Scope              | Adds                           | Routes                                                                    |
| ------------------ | ------------------------------ | ------------------------------------------------------------------------- |
| `viewer` (default) | nothing                        | —                                                                         |
| `fleet`            | the fleet licence fact         | `PUT /api/v1/licence/fleet`                                               |
| `tokens:write`     | issue and revoke endpoint keys | `POST`, `DELETE /api/v1/endpoints/{id}/keys…`                             |
| `plans:write`      | write plans and start rollouts | `PUT /api/v1/endpoints/{id}/plan`, `POST /api/v1/endpoints/{id}/rollouts` |

```bash
opodcp token create --scope plans:write --expires-in 2160h --cp https://cp.example.com --token <admin token> ci-deployer
opodcp token ls
opodcp token revoke tok_1a2b3c4d5e6f
```

Tokens are kept as SHA-256 hashes and shown once. They do not expire unless you give `--expires-in`. A token carries no team, so a write scope acts on every endpoint of the cell. Its writes are audited as `token:<name>`. A program that needs two kinds of write holds two tokens. The console's **Teams & quotas → Machine tokens** card does the same.

## Credentials never travel in a URL

`?token=` on any role-gated route is refused `401 credential_in_url`, and its value is never read or logged. The four routes a browser drives without a header (`GET /events`, `/api/v1/usage/export`, `/api/v1/audit/export`, `/api/v1/audit/chain`) accept a single-use **ticket** instead: `POST /api/v1/stream-ticket` mints one that lives 30 s, carries the caller's identity, role and team, and is spent by the first request. Scripts send the header on those routes like any other.

## API rate limit

`api.rateLimit.rps` and `.burst` (off by default) give every caller one token bucket, judged after the identity resolves. Over it, `429 rate_limited` with `Retry-After`; no other caller is affected.
