# Identity classes

> Every authentication path on the platform belongs to exactly one of three identity classes, and the class names the mechanism that governs it. A workload…

Source: https://openlakeforge.dev/docs/architecture/identity/identity-classes/

Every authentication path on the platform belongs to exactly one of three
identity classes, and the class names the mechanism that governs it. A
workload can use several paths: a run pod is class 2 to Trino and class 3 to
S3. This page is the contract
documentation for those classes (#178); the path-by-path inventory is in
[identity-callers.md](https://github.com/OpenLakeForge/openlakeforge/blob/v0.7.5-beta.1/docs/architecture/identity/identity-callers.md).

| Class | Who | Governed by | Never |
| --- | --- | --- | --- |
| 1. Human | A person reaching a service UI through the issuer: a GitHub account, or a user of an external OIDC issuer | Canonical roles from the GitHub team mapping, or from the external issuer's claim mapping (`role_claim`, `role_mapping`), enforced at the perimeter ([ADR 0014](https://openlakeforge.dev/docs/adr/0014-identity-and-authorization/), [ADR 0018](https://openlakeforge.dev/docs/adr/0018-github-is-the-forge/)) | Used by a deploy, a pipeline or any other automated path (the e2e perimeter test below is the one exception) |
| 2. In-cluster workload and automation | A pod calling another component, or `olf infra` commands and CI calling the cluster | A service credential from a Kubernetes Secret, or Kubernetes RBAC | A human account; routed through the perimeter; a member of a canonical role |
| 3. Cloud workload | A pod calling a cloud API (object storage, catalog, secrets) | Cloud IAM through EKS Pod Identity or Azure workload identity | A canonical role |

## The classification rule

The class belongs to the operation, not to the `olf` executable. A caller that
reaches a service **through the issuer** is class 1. A caller that
authenticates with a service credential or with Kubernetes RBAC is class 2,
whether it runs in a pod or on a workstation, and even when a person started
it. A command that needs neither has no identity.

For `olf` that gives three surfaces ([ADR 0020](https://openlakeforge.dev/docs/adr/0020-infrastructure-common-and-platform-cli-surfaces/)):

| Surface | Commands | Class |
| --- | --- | --- |
| Infra | Everything under `olf infra` (`deploy`, `plan`, `query`, `project deploy`, ...), and CI running them | 2, with Kubernetes RBAC or cloud IAM as the identity |
| Common | `olf init`, `check`, `profile`, `project validate` and the other commands that need no permissions | None |
| Platform | `olf login`, `whoami`, `logout` and `query` through a Dex session; `domain list` planned | 1 |

The four canonical roles apply to class 1 only. A
role never grants a pod anything, and a service credential never signs a person
in.

## Class 1: human

| Item | Detail |
| --- | --- |
| Identity | A GitHub account, brokered by Dex into an OIDC token; or, with `issuer: external`, a user of that issuer |
| Authorization | The highest canonical role among the person's mapped teams, or among the roles the external issuer's claim maps to ([Roles and permissions](https://openlakeforge.dev/docs/reference/roles-and-permissions/)) |
| Automated test of the perimeter | `olf e2e` signs in through Dex as stub users, one per mapped role, against a stub GitHub it runs in `olf-system`. These users exist for the run, hold canonical roles, and are never used by a deploy or a pipeline: the one place a class 1 path is driven by automation, so that the perimeter's redirects, role refusals and logout are tested through the public hostnames |
| Enforcement | The perimeter (oauth2-proxy behind Traefik forwardAuth) refuses a route the role does not hold; with GitHub sign-in, Superset also maps the role to its native roles, and OpenMetadata gets its native roles only from the GitHub role sync. With `issuer: external`, Superset and OpenMetadata get no OIDC configuration: users pass the perimeter and then need each service's own login |
| Lifetime | Perimeter cookie 30 min idle, 10 h absolute; access token 5 min; with Dex, a revocation reaches the perimeter within about 5 min. With an external issuer, a removed role can last up to the issuer's 10 h SSO lifetime when its refresh responses carry no ID token with the role claim ([identity-sessions-and-recovery.md](https://github.com/OpenLakeForge/openlakeforge/blob/v0.7.5-beta.1/docs/architecture/identity/identity-sessions-and-recovery.md)) |
| Operations | [Add, change or remove a member](https://openlakeforge.dev/docs/guides/identity/manage-members/) |
| Command line | The `olf-cli` public OIDC client (no secret): the perimeter accepts its bearer tokens and applies the same role floor as for a session. `olf query` uses it: the perimeter checks the token, Trino has no authentication of its own and passes the token on, and Polaris grants the role's `data_access` row ([ADR 0016](https://openlakeforge.dev/docs/adr/0016-trino-workload-authentication/), [ADR 0019](https://openlakeforge.dev/docs/adr/0019-data-plane-authorization-deferral/) D6, D7). `olf infra query` stays class 2 |

## Class 2: in-cluster workload and automation

| Item | Detail |
| --- | --- |
| Identity | A ServiceAccount or kubeconfig user, or a service credential created in the cluster |
| Examples | `olf infra deploy`, `olf infra e2e` and CI (RBAC, port-forward or in-cluster exec); Superset, dbt and OpenMetadata ingestion to Trino; Trino and Floe to Polaris; pods to PostgreSQL and object storage |
| Authorization | Kubernetes RBAC for operators and CI. For pods, a per-service credential from a Secret that a bootstrap Job generates once and reuses |
| Network | Reachability between pods is decided by default-deny NetworkPolicy ([identity-network-policy-and-rbac.md](https://openlakeforge.dev/docs/architecture/identity/identity-network-policy-and-rbac/)) |
| Trino | No authentication of its own: every caller sends its own Polaris token, and Polaris decides what each query reads ([ADR 0016](https://openlakeforge.dev/docs/adr/0016-trino-workload-authentication/), [ADR 0019](https://openlakeforge.dev/docs/adr/0019-data-plane-authorization-deferral/) D3, D9) |
| Rotation | `olf infra secrets rotate` for `dex-client-perimeter` and `github-app`; the Superset and OpenMetadata clients are rotated by hand ([Rotate secrets](https://openlakeforge.dev/docs/guides/identity/rotate-secrets/)); other credentials as the inventory states ([identity-credentials.md](https://github.com/OpenLakeForge/openlakeforge/blob/v0.7.5-beta.1/docs/architecture/identity/identity-credentials.md)) |

Workstation and CI automation reaches services by an RBAC-authorized
`kubectl port-forward` or by in-cluster execution for routes protected by the
perimeter, never through those public hostnames and never as a human or
administrator account. With `spec.access` but no perimeter, `olf` uses the
ingress hostname (`access.service_url()`). Who may automate is
who holds `pods/portforward` and the Secret reads in RBAC.

Known limitation: a service credential is shared by every user of the
component it fronts, so it cannot tell two people apart. Data access is not
decided by one: Superset sends each signed-in viewer's own token to Trino, a
query that carries no token is refused, and Polaris grants what that person's
role reads
([ADR 0019](https://openlakeforge.dev/docs/adr/0019-data-plane-authorization-deferral/) D11).

## Class 3: cloud workload

| Item | Detail |
| --- | --- |
| Identity | The cloud's workload identity of a pod |
| Mechanism | `identity.aws_pod_identity` on AWS, `identity.azure_workload_identity_ready` on Azure, both fields of the provider contract |
| Authorization | Cloud IAM policy on that identity |
| Status, AWS | Implemented: IAM roles with EKS Pod Identity |
| Status, Azure | OIDC readiness only (`identity.azure_workload_identity_ready`) |
| Scope | Exercising cloud credentials is outside the v0.5 scope |

OpenLakeForge roles are never cloud IAM permissions, and a cloud identity never
holds a canonical role.

## Break-glass

When the issuer is down, a cluster administrator is a class 2 caller: their
kubeconfig, not the issuer, is the authority. `olf infra break-glass` uses that to
reach a service for a bounded time and records the use
([Break-glass access](https://openlakeforge.dev/docs/guides/identity/break-glass/)). It does not turn
the perimeter off.

---

<small>Synced from openlakeforge @ `v0.7.5-beta.1` (`8a7bf72`), [docs/architecture/identity/identity-classes.md](https://github.com/OpenLakeForge/openlakeforge/blob/8a7bf7296968594c1676b0f581f7c40c3d31b7ba/docs/architecture/identity/identity-classes.md).</small>
