# Identity and access

People sign in through an OIDC provider, through Cloudflare Access, or through
a [front proxy](/docs/configure/#sign-in-through-a-front-proxy) that you run, and
Kubernetes RBAC decides what they can do. Signing in grants no access until a
RoleBinding or ClusterRoleBinding refers to the person's username or to one of
their groups. For the steps, see
[Sign in to a cluster](/docs/sign-in/).

## Usernames and groups

| Variable                   | What it sets                                          | Default                       | Set in        |
| -------------------------- | ----------------------------------------------------- | ----------------------------- | ------------- |
| `KITE_OIDC_USERNAME_CLAIM` | The OIDC claim that contains the username             | `email`                       | `deploy.env`  |
| `KITE_OIDC_GROUPS_CLAIM`   | The OIDC claim that contains the groups               | `groups`                      | `deploy.env`  |
| `KITE_OIDC_PREFIX`         | The prefix on the username and on every group         | `oidc:`                       | `deploy.env`  |
| `KITE_OIDC_SCOPES`         | The scopes `kite login` requests                      | `openid email offline_access` | `deploy.env`  |
| `KITE_OIDC_JWKS`           | The issuer's signing keys, as a JSON Web Key Set      | The keys the issuer publishes | `deploy.env`  |
| `KITE_OIDC_ADMIN_USER`     | One username, with the prefix, in `system:masters`    | None                          | `deploy.env`  |
| `KITE_ADMIN_GROUP`         | A group, without the prefix, bound to `cluster-admin` | None                          | `deploy.env`  |
| `KITE_ACCESS_GROUPS_CLAIM` | The Cloudflare Access claim that contains the groups  | `groups`                      | The dashboard |
| `KITE_ACCESS_PREFIX`       | The Cloudflare Access prefix                          | `access:`                     | The dashboard |

`kite deploy` passes each variable that you set in `deploy.env` to the Worker,
and `kite local up --oidc` passes the ones in a file to a
[local cluster](/docs/reference/cli/#oidc-issuer). A deploy removes a
`KITE_OIDC_` variable from the Worker when `deploy.env` no longer sets it, even
one that you set in the dashboard. For usernames and groups with no prefix, set
`KITE_OIDC_PREFIX=` in `deploy.env`: `kite deploy` passes that empty value, and
skips any other empty value. Set the `KITE_ACCESS_` variables as Worker
variables in the Cloudflare dashboard, and later deploys keep them. With
Cloudflare Access, the username comes from the `email` claim.

With `KITE_OIDC_JWKS`, the cluster checks each token against the keys in the
value and never fetches the issuer's discovery document or keys. Set it when
the cluster cannot reach the issuer. When the issuer changes its keys, set the
new ones and deploy again. A Worker variable holds at most 5 KB.

The value must be a JSON object whose `keys` list holds at least one key.
`kite deploy` and `kite local up --oidc` refuse any other value, and the
control plane does not start with one:

```text
KITE_OIDC_JWKS is not a JSON Web Key Set: it is not JSON, at line 1 column 20. Set it to the issuer's keys as {"keys":[...]}, or remove it to fetch the keys from the issuer.
```

:::caution
The prefix applies to groups too. A provider group `admins` becomes
`oidc:admins` in RBAC, so a binding to `admins` grants nothing.
`access:ada@example.com` and `oidc:ada@example.com` are two users, and each
needs its own binding. Run `kite whoami` before you create a binding.
:::

After the cluster adds the prefix, it rejects a username that starts with
`system:`, and removes any group that starts with `system:`.

`KITE_OIDC_ADMIN_USER` adds one OIDC user to `system:masters`, such as the
user of a management plane that installs roles in the cluster. Write the username as RBAC reads it, with the prefix:
`oidc:control@example.com`. A token for that user can do everything that the
administrator token can, so trust the OIDC issuer as you would trust anyone
who has the administrator token.

## Credentials

[Cluster credentials](/docs/security/#cluster-credentials) lists each
credential, who uses it, what it can do and where it is stored. If your
identity provider is down, nodes and pods keep working.

:::caution
The administrator token is a deployment secret, not a personal account. Keep it
out of ordinary kubeconfigs, and use an identity with RBAC for daily work.
:::

## Token issuer

A token that Kite signs authenticates only at the cluster address that it names
as its issuer. See [Set the cluster address](/docs/configure/#set-the-cluster-address)
and [Set the cluster issuer and browser origins](/docs/configure/#set-the-cluster-issuer-and-browser-origins).

## Next

- [Sign in to a cluster](/docs/sign-in/): log in and create RBAC bindings.
- [Configure a deployment](/docs/configure/): set up OIDC and Cloudflare Access.
