---
title: Roles and permissions
summary: Tessera puts a person's roles and permissions into their tokens, so your app can decide what they may do without calling back.
section: concepts
order: 4
---
# Roles and permissions

Tessera puts a person's roles and permissions into their tokens, so your app can decide what they may do without calling back.

## The model

- An **access app** is a namespace for permissions, such as `argus`. It is bound to the client ids of your app and to the resource addresses (audiences) that its tokens are meant for.
- A **role** is a named bundle of permissions, such as `argus:admin`.
- A **permission** is a string made of colon-separated segments, such as `argus:reports:read`. A `*` segment matches exactly one segment, and a last segment ending in `*` matches the rest. So `argus:*:read` grants `argus:reports:read` but not `argus:reports:sub:read`, and `argus:*` grants both.
- A **group** is a set of people, agents or services. Give roles to a group instead of to each person.
- A role can be marked **Everyone in realm**. It then applies to every user of the realm. It is off unless you turn it on.

Roles and permissions of an app must stay inside its namespace: a role of the app `argus` can grant only `argus:...` permissions. The namespace `tessera` is reserved.

## The `roles` claim

`roles` is a list of strings. A role of an app is written `<app>:<role>`, for example `argus:admin`. A role that belongs to the whole realm and not to an app is written as its bare key. The claim is left out when the list is empty.

## The `permissions` claim

`permissions` is the list of permissions that the person's roles grant. It is left out when empty. Authorize on permissions, not on role names, so you can change what a role means without changing code.

## Where each claim appears

| Token | `roles` | `permissions` |
| --- | --- | --- |
| Access token | Yes | Yes |
| ID token | Yes | No |
| Userinfo response | Yes | Yes |

The same claims appear on tokens for users, for confidential clients using `client_credentials`, and for agents and workloads. Role changes do not show in an existing token: the claims are a snapshot until the token expires (15 minutes for access tokens by default), and the next refresh sees the change.

## How the audience filters them

A token for one app must not list the roles of another. Tessera filters like this.

- **Access token.** Roles and permissions of an app are included only when one of the token's audiences is one of that app's audiences. Roles that belong to the whole realm are always included. Two cases decide the audience:
- **A plain sign-in app.** A plain sign-in app (an OpenID Connect client with no allowed resources) sends no `resource`. Its access token has its own `client_id` as `aud`, and carries the roles and permissions of every access app that lists that client.
- **An app that calls an API.** An app that calls an API, or an MCP server, names the API with the `resource` parameter on `/authorize` and `/token`. The token's audience is that resource, and only the apps that list it as an audience contribute roles.
- **ID token.** Roles of an app are included when the receiving client is one of the app's client ids. Realm-wide roles are always included. There are no permissions in the ID token. Use it for decisions in the interface, such as showing an admin link.
- **Userinfo.** It applies both rules: the audience of the access token you present and the client it was issued to.

Example: a person holds `argus:member` and `secrets:reader`. They ask for a token with the audience of the `argus` app. The token has `roles: ["argus:member"]` and only the permissions of `argus:member`.

If the access token has no `roles`, the usual cause is that the token's `aud` is not one of the app's audiences. For a call to an API, check the `resource` you sent. For a plain sign-in app, check that the access app lists your client (its `client_ids`). If Tessera cannot read the roles, it issues the token without them rather than with stale ones.

```json
{
  "aud": "https://api.argus.example",
  "roles": ["argus:admin", "argus:member"],
  "permissions": ["argus:*", "argus:app:use"]
}
```

## Agents never exceed their person

When an agent acts for a person through token exchange, the token carries only what both hold. Roles and scopes must be held by both. Permissions are the narrower of each overlapping pair. See [acting for a person](/docs/agents/acting-for-a-person.md).

## Limit who can sign in

By default any user of the realm can sign in to any app in it. Set `required_roles` on a client (up to 64 entries, each an existing role) and Tessera refuses everyone who holds none of them. A refused person sees a "No access" page and your app gets no code. With `prompt=none` the app gets `access_denied`. The check also runs when tokens are issued or refreshed, so removing a role stops a refresh with `invalid_grant`. An "Everyone in realm" role cannot be a gate.

## The `groups` claim

ID tokens and userinfo also carry `groups`. It lists administrative groups, not your access groups. Do not use it to authorize your app. Use `roles` and `permissions`.

## Give roles to people

- In an invite: [invites](/docs/customize/invites.md#roles-in-an-invite).
- With a binding to a user or a group, using the admin API or `tessera access bind`. A binding can expire.

## Read the claims

See [claims](/docs/reference/claims.md) for every claim, and [connect overview](/docs/connect/overview.md) for validating tokens.
