# Just-in-time user provisioning

**Last updated:** 2026-11-21T09:07:48-03:00 (UTC-3)

With `federated_jit`, the first [OIDC](/docs/features/oidc/) or [SAML](/docs/features/saml/) login of a person who has no local user creates one, as long as the identity is on an allowlist. The new user waits for an administrator: until approved, the login says the account is pending and nothing else. It is created with the `user` role and **no teams**, exactly as [SCIM](/docs/features/scim/) creates users; nothing the identity provider sends grants a role or a team.

## How to turn it on

On top of a working OIDC or SAML login:

```yaml
features:
  federated_jit: true        # boot; requires console_users, granular_rbac, team_scoped_console and oidc_login or saml_login
admin:
  jit:
    allowed_email_domains: [example.com]     # a verified e-mail of one of these domains, or
    allowed_groups: [/gateway-users]         # one of these groups
    # require_approval: true                 # default; false creates the user active (still without teams)
    # oidc_groups_claim: groups              # ID-token claim with the groups
    # saml_email_attribute: email            # assertion attribute with the e-mail
    # saml_groups_attribute: groups          # assertion attribute with the groups
    # saml_email_verified_attribute: ''      # optional attribute whose value must be "true" for the e-mail to count
    # max_pending: 1000                      # users waiting for approval; past it, new first logins are refused
```

| Field | Rule |
| --- | --- |
| `allowed_email_domains` | Up to 50 unique lowercase DNS names. The e-mail domain must match exactly: `sub.example.com` is not `example.com` |
| `allowed_groups` | Up to 50 unique groups, up to 256 bytes each, compared exactly (case-sensitive) |
| `require_approval` | `true` when omitted: a first login creates a pending user that an administrator approves; `false` creates the user active, still without teams |
| `oidc_groups_claim` | A top-level claim name; identity, role and protocol claims are reserved |
| `saml_email_attribute`, `saml_groups_attribute`, `saml_email_verified_attribute` | Distinct attribute `Name`s of up to 256 characters; the last is optional |
| `max_pending` | 1 to 100000; `1000` when omitted. A bound on the users waiting at once, not exact under concurrent first logins |

With JIT enabled, the configured OIDC issuer must fit within 2048 UTF-8 bytes. SAML entity IDs retain their 2048-byte bound. Migration 115 widens the original JIT issuer constraint without changing existing identity links, approval decisions or migration 108 history.

At least one domain or group is required; without an allowlist the gateway refuses to start. PostgreSQL holds the users and their links.

## What the identity provider must send

- **OIDC:** an e-mail counts only with `email_verified: true`. When domains are listed, the gateway also asks for the `email` scope, which providers such as Google need to send it; enabling this changes the OIDC configuration and requires a new login. Groups come from `oidc_groups_claim`; a claim that is not a list of up to 128 strings counts as no groups.
- **SAML:** the e-mail is the single value of `saml_email_attribute` and the groups the values of `saml_groups_attribute` (values of a repeated name merge), both from the signed assertion. **The IdP must release only verified or administrator-managed e-mails**, because SAML carries no standard verified flag: an e-mail a user can change unverified would let them match a domain. If the IdP sends one, set `saml_email_verified_attribute` and only `true` counts. Values that do not fit (more than one e-mail, more than 128 groups, an invalid group) count as absent, so they only narrow admission, and attributes are read only for JIT: a statically mapped login never depends on them. The assertion is spent before anything is created, so a replayed response never creates a user. The NameID must be persistent, as for every SAML login.

The identity is the protocol, the issuer (OIDC) or IdP entity (SAML), and the subject (OIDC `sub` or SAML NameID). A static `subject_users` entry and a SCIM link take precedence over JIT.

## Approving

**Console users** lists the new user as **Pending approval**, created on first OIDC or SAML login. The same person signing in through both protocols is two identities, so two users, each decided on its own. **Approve** enables it; **Reject** keeps it disabled for good: JIT never recreates that identity and SCIM cannot reactivate the user. A static `subject_users` entry or a SCIM link for the same subject still takes precedence, as everywhere else. The API is `POST /api/v1/admin/users/{id}/approve` and `/reject`, with the `users:manage` permission.

Approval alone does not open the console: like every `user`, the account needs a team, which an administrator assigns in **Console users**. The display name is the e-mail the IdP asserted, so check it against the IdP before approving: names are not unique. Disabling it later ends its sessions as for any user.

## Limits

- No role, team or permission comes from the identity provider, by design; use [SCIM groups](/docs/features/scim/#groups) for teams that follow the IdP.
- A person removed from the group or domain in the IdP keeps the local user; disable it in the console, or use SCIM.
- Decision 3 (the IdP never grants a team) is revised for team membership only by [IdP groups to team membership](/docs/features/idp-team-sync/) (`idp_team_sync`): mapped groups add and remove `idp:` member memberships. The IdP still never grants a role.
- Real acceptance covered Keycloak; other providers follow the same claims and attributes but have not been certified.

## Admin API routes

Every route below needs a console session or an admin Bearer token, the role's permission and, for writes, the `X-CSRF-Token` header; the full contract is in the [API reference](/docs/api/).

| Route | What it does |
| --- | --- |
| `POST /api/v1/admin/users/{id}/reject` | Rejects a pending user created by a first SSO login |
