Skip to content
Workforce IdentityMarkdown

Entitlements

Name what a user, a group or an agent holds, for as long as you choose, and let it decide the scopes and permissions their tokens may carry.

AvailableAPI

An entitlement is a named bundle of access, such as invoices or small payments, that you grant to a user, a group or an agent. It decides which scopes their tokens may carry, and which structured permissions, such as a payment of at most 500 EUR. Grant it to a group and every member holds it; give the grant an end date and it lapses by itself.

Use entitlements for what someone holds. For which calls are allowed on an API, write policies; a policy can then require a scope only an entitlement grants.

  • Who can do it: a realm administrator, in a group that holds RealmOwner (Delegated administration). RealmViewer can read entitlements and grants.
  • Where: today this is done through the API (Call the API shows how to get $CVYUH_SESSION).

An entitlement is an entitlement object: a unique code; the scopes it grants; optionally the authorizationDetails it grants, as templates (a type, and a bound on each field its holder may ask for); optionally the resources its scopes are for; and optionally its own window (validFrom, validTo).

Someone holds it through a grants link from a user, a group or an agent to the entitlement, with its own validFrom, validTo and grantedBy. A group’s grants reach its members.

The entitlements someone holds right now are worked out whenever they’re read, from the links whose window is open and whose entitlement’s own window is open. Nothing is stored or swept when one lapses.

What they decide:

  • The scopes a token carries. Once an entitlement names a scope, that scope is issued only to its holders: see Governed scopes.
  • The structured permissions a token carries. An authorization_details object is issued only when a template its holder holds admits it: see Rich authorization requests.
  • What the issuance policy sees. The codes of the entitlements held reach the realm’s issuance policy, so a policy can name them.

Each call sends your session as $CVYUH_SESSION (Call the API).

  1. Write the entitlement. Its id is its code:

    Terminal window
    curl -X POST "https://foobar.cvyuh.com/api/v0/am/objects/v1/entitlement?id=invoices" \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "code": "invoices", "scopes": ["invoices", "invoices:read", "invoices:write"],
    "resources": ["https://app.example.com/api"] }'
  2. Grant it to a group (or a user, or an agent) through their grants link, with an optional window:

    Terminal window
    curl -X POST https://foobar.cvyuh.com/api/v0/am/objects/v1/group/finance/relationships/grants \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "targetId": "invoices", "properties": { "validTo": "<RFC 3339 time>" } }'
  3. Check what a holder has:

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/am/objects/v1/group/finance/relationships/grants \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

To take a grant back, delete the link: DELETE the same address followed by /invoices. To end it at a set time, give it a validTo.

Nothing at sign-in. A user who lacks a governed scope gets a token without it, and the app’s call that needs it is refused by the API. A user whose grant lapses loses the scope at the app’s next refresh.

Setting or limitDefaultRange
Entitlements in a realmfewer than 1,000; at 1,000, token requests are refused 503
scopes on an entitlementat least one
validFrom, validTo on an entitlement or a grantopenany time
SymptomCauseFix
A token comes back without a scope it asked forThe scope is governed, and the user holds no entitlement that grants it, or the grant’s window is closedGrant the entitlement, or check validFrom and validTo
A client acting as itself never gets a scopeClients acting as themselves hold no grantsUse a scope no entitlement names for that client
Writing an entitlement is refusedIt names a sign-in or platform scopeLeave those scopes out
Every token request answers 503The realm holds 1,000 entitlements or moreRemove unused ones

Writing an entitlement, and adding or removing a grant, is recorded in Audit → Config (Change history), with the grant’s grantedBy. Each token records what was asked and what was granted in its TOKEN_ISSUED record (Audit → Authentication), so a scope left out shows there.

  • A lapsed entitlement still governs its scopes. Letting it lapse takes its scopes from everyone, rather than freeing them for anyone.
  • Lapsing takes effect on the next check. Every refresh, exchange and introspection checks a token’s governed scopes again, so a token whose grant has lapsed reads as inactive at introspection.
  • A client acting as itself holds no grants, so a governed scope is never issued to it.
  • No sign-in or platform scopes. An entitlement can’t name openid, profile, email, address, phone, offline_access, or the scopes the realm’s own services need: writing one is refused. See Governed scopes.
  • Fewer than 1000 per realm. At 1000 or more, the realm won’t work out a token’s scopes from a partial list: a token request is refused temporarily_unavailable (503) instead.
WhereFieldWhat it sets
entitlementcode, scopesIts unique code, and the scopes it grants. Both required
entitlementauthorizationDetailsThe structured permissions it grants, as templates
entitlementresourcesThe APIs its scopes are for. None means every API
entitlementvalidFrom, validToWhen the entitlement itself is open
grants link on a user, group or agentvalidFrom, validTo, grantedByWhen this holder holds it, and who granted it