Single sign-on#

Let people sign in to the dashboard through your OpenID Connect (OIDC) identity provider, with roles from their groups.

Describe the identity provider in a file, such as oidc.yaml:

YAML
providers:
  - id: company
    displayName: Company SSO
    issuer: https://login.example.com/oauth2/default
    clientId: <client-id>
    clientSecretEnv: TOKEDEX_OIDC_COMPANY_SECRET
    allowedEmailDomains: [example.com]
    jit: true
    roleMapping:
      orgRoles:
        admin: [tokedex-admins]
        member: [engineering]

Keep the file and the client secret in one Secret. Save the client secret in a file named client-secret, with no trailing newline:

Shell
kubectl -n tokedex create secret generic tokedex-oidc \
  --from-file=oidc.yaml \
  --from-file=client-secret

Merge these into release-values.yaml, adding the entries to any extraEnv, extraVolumes or extraVolumeMounts list it already has, and run the helm upgrade from Deploy to production. Every replica restarts with the file mounted. The gateway reads the file only at start-up, and refuses to start on an unknown field or an unset secret. After every change to the file or the secret, run kubectl -n tokedex rollout restart deployment/tokedex.

YAML
extraEnv:
  - name: TOKEDEX_OIDC_PROVIDERS_FILE
    value: /etc/tokedex/oidc/oidc.yaml
  - name: TOKEDEX_OIDC_COMPANY_SECRET
    valueFrom:
      secretKeyRef:
        name: tokedex-oidc
        key: client-secret
extraVolumes:
  - name: oidc
    secret:
      secretName: tokedex-oidc
      items:
        - key: oidc.yaml
          path: oidc.yaml
extraVolumeMounts:
  - name: oidc
    mountPath: /etc/tokedex/oidc
    readOnly: true

Open Members → Sign-in and choose Check. Identity providers lists Company SSO, and the row reads ok once the gateway reaches the identity provider.

You need: a gateway served over HTTPS with its public URL set, an application at your identity provider, and an organisation Owner account with emergency sign-in, for when the identity provider is down. Single sign-on stays off until the public URL is set; the gateway logs a warning at start-up.

Register an OIDC application#

Register an OIDC application at your identity provider with the redirect URI https://gateway.example.com/auth/v1/oidc/company/callback. Use the id from your provider file in place of company, with up to 32 lowercase letters, digits and hyphens. Copy the issuer URL and client ID into the file. Supply the client secret through the Kubernetes Secret above and set clientSecretEnv to the name of the environment variable that holds it.

Use the issuer exactly as the provider's tokens carry it. For Microsoft Entra ID, use your tenant's issuer: the gateway refuses the multi-tenant ones.

Provider file settings#

  • allowedEmailDomains admits only those addresses. List your own domains, so only your organisation's addresses get accounts.
  • jit: true creates an account at a person's first sign-in. Without it, people need an invitation or a linked account.
  • roleMapping.orgRoles gives each organisation role to the groups listed, and a person gets the highest one: here engineering signs in as a Member and tokedex-admins as an Admin.
  • clientSecretEnv names the variable that holds the client secret, which must start with TOKEDEX_OIDC_.

Mapping groups to Owner needs allowSuperRole: true in roleMapping. Leave it off and make Owners by hand, so a change to a group at the identity provider cannot hand out full control. Google's ID tokens carry no groups. With Google, invite people instead of mapping groups.

Every field and sign-in rule is in the single sign-on reference.

Test sign-in#

  1. Sign in as an organisation Owner or Admin and open Members → Sign-in.
  2. Choose Test sign-in and sign in as someone who should get access. The result shows the claims the gateway read and the roles it would assign. Nothing is created.
  3. Repeat as someone who must be refused.
  4. Ask a real user to choose Continue with Company SSO on the sign-in page, then check their roles in Members.

From a deployment script, check it with the master key or an admin key with the auditor preset. The gateway contacts the identity provider; nobody signs in.

Shell
curl -sS -X POST "$TOKEDEX_URL/control/v1/sso-providers/company/check" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY"
JSON
{
  "object": "sso_provider",
  "id": "company",
  "displayName": "Company SSO",
  "redirectUri": "https://gateway.example.com/auth/v1/oidc/company/callback",
  "enabled": true,
  "discovery": { "state": "ok", "checkedAt": 1795137738974 }
}

discovery.state is failing, with a reason, when the gateway cannot reach the provider.

Map groups to workspace roles#

Select the workspace and open Settings. Under Identity-provider groups, enter a group, choose its role, then choose Add group. Choose Save groups to open Review group changes. Review the changes and choose Save groups in the dialog to apply them.

The gateway applies group changes at a person's next sign-in, and never removes the last Owner. To end someone's access at once, open them in Members and choose Disable; do this as well as removing them at the identity provider, since an open session outlasts a group change.

If you already have an account, sign in with your password before using SSO for the first time. Open Account → Profile & sign-in and choose Connect Company SSO. Linking removes your password unless your account has emergency sign-in.

With jit: true, signing in through SSO before linking can create a separate account if the address on your existing account is unverified, as with a password invitation. If the identity provider verifies an email address that an existing account already holds as verified, the gateway refuses the new sign-in with sso_account_exists until you link the identity.

Require single sign-on#

Require it only once Test sign-in admits and refuses the right people, and at least one Owner, better two, has emergency sign-in and has signed in with its password. Otherwise only the master key signs in while the identity provider is down, and the gateway warns you of that.

  1. Sign in as an organisation Owner and open Members → Sign-in.
  2. Under Sign-in settings, select Require single sign-on and choose Save.

From then on, a password signs in only an account with emergency sign-in, and the master key still signs in. Open sessions continue: Sign everyone out ends them and revokes every personal access token. Choose it when sessions opened with a password must end now, and warn people first, since their tokens stop too.

Next: People and workspaces, Recover dashboard access or HTTPS and reverse proxies.