Skip to content
Workforce IdentityMarkdown

Rich authorization requests

Grant exact permissions, such as one payment of up to 500 EUR to a named account, in place of broad scopes.

AvailableAPIRFC 9396

A scope such as payments:send says what kind of thing a token may do, and nothing about how much. With rich authorization requests, a client asks for exactly what it needs in a structured authorization_details field: one payment, of a set amount, to a named account. The user sees those objects at consent, the token carries them, and the API checks them.

Use them for payments, health records and any action where what exactly matters more than which kind, and wherever a scope would grant more than the one action a client needs. They work at the realm, in an agent’s bounded approvals, and in the policies the gateway enforces.

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

You set three things: which types of object the realm accepts, which a client may ask for, and, through an entitlement (see Entitlements), how far each holder may go.

The realm accepts a type, with the JSON Schema its objects must satisfy, in authorizationDetailsTypes:

{ "authorizationDetailsTypes": {
"payment_initiation": { "type": "object", "required": ["type"],
"properties": { "type": { "type": "string" }, "instructedAmount": { "type": "object" } } }
} }

The client lists the types it may ask for: "authorizationDetailsTypes": ["payment_initiation"].

An entitlement bounds what is granted, through a template. Each key is a field’s dotted path, and each value its bound: one of a list (in), a range (min, max), a subset of a list (subsetOf) or an exact value (equals):

{ "code": "payments-small", "scopes": ["pay"],
"authorizationDetails": [
{ "type": "payment_initiation",
"instructedAmount.currency": { "in": ["EUR"] },
"instructedAmount.amount": { "max": 500 } }
] }

The client asks, here an agent’s client under the client-credentials grant, for an agent that holds the entitlement. The objects go as a URL-encoded JSON array:

Terminal window
curl https://foobar.cvyuh.com/oauth2/token \
-H "DPoP: <proof>" \
-d grant_type=client_credentials \
-d client_id=invoice-agent-client \
-d client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer \
-d client_assertion=eyJ… \
-d scope=pay \
--data-urlencode 'authorization_details=[{ "type": "payment_initiation",
"instructedAmount": { "currency": "EUR", "amount": 100 } }]'

The token response returns the same array as authorization_details, and the access token carries it as its authorization_details claim. The same request for 900 EUR is refused invalid_authorization_details.

The gateway can require them. A policy’s OAuth2AuthorizationDetails condition names the objects a call needs, in the same bounds: a token carrying one passes, and any other is refused. The condition constrains only the fields it names, so an object may carry more. It doesn’t compare the objects with the request’s body.

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

  1. Add the type and its schema to the realm’s authorizationDetailsTypes:

    Terminal window
    curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Settings/oauth2Settings \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "authorizationDetailsTypes": {
    "payment_initiation": { "type": "object", "required": ["type"],
    "properties": { "type": { "type": "string" },
    "instructedAmount": { "type": "object" } } } } }'
  2. Add the type to each client’s authorizationDetailsTypes that may ask for it:

    Terminal window
    curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Client/invoice-agent-client \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "authorizationDetailsTypes": ["payment_initiation"] }'
  3. Write an entitlement whose authorizationDetails holds a template for the type, and grant it, as on Entitlements.

At consent, the user sees every object whole, field by field, and allows or denies the request as a whole. A request with authorization_details always asks, even where consent would be remembered.

Setting or limitDefaultRange
Types the realm accepts (authorizationDetailsTypes)noneeach with its JSON Schema
Types a client may ask fornonewithin the realm’s
Remembered consent for objectsnever
SymptomCauseFix
invalid_authorization_details naming a typeThe realm doesn’t accept the type, or the client may not ask for itAdd the type to the realm, then to the client
invalid_authorization_details for a valid-looking objectNo held template admits it, or it has a field the template doesn’t boundWiden the template, or ask for less
An exchanged token has no objectsToken exchange doesn’t carry them yetSee What’s next

The TOKEN_ISSUED record of each token request holds what was asked; a refusal holds the error and its reason (Audit → Authentication). Changes to accepted types and templates are in Audit → Config.

  • Refused, never reduced. An object outside what’s granted fails the whole request, naming the object. The realm never quietly issues a smaller one.
  • Only what’s accepted. An object must name a type the realm accepts and this client may ask for, and satisfy its type’s schema. A value that isn’t a JSON array is refused too.
  • A template admits only what it bounds. A field the template doesn’t bound is refused, so an object can’t widen itself by adding one. min and max read a number, or a decimal string such as "123.50". Any other bound is refused when the template is written. A type no template governs is issued as asked.
  • Consent shows every object whole, and a request with authorization_details always asks the user, even where consent would be remembered or implied.
  • The objects travel with the grant. The code carries them, and they’re checked against the grants again when it’s redeemed. A token request may name a subset of them, never add one. A refresh token carries them too, and its requests narrow the same way.
  • A token stands only while its objects are still granted. At introspection, a token whose objects a held template no longer admits is inactive.
  • Which grants take them. The authorization code grant; client credentials, for a client acting as itself (which holds no entitlements, so gets only types no template governs) or as its agent; and backchannel authentication, where the objects are checked against the owner’s grants when the agent asks, so the owner never sees one they couldn’t grant. The device and jwt-bearer grants take none. A request for an identity assertion that carries authorization_details is refused invalid_request (see Issuing identity assertions).
  • Discovery lists the types the realm accepts, as authorization_details_types_supported.
ErrorWhen
invalid_authorization_detailsThe value isn’t a JSON array; an object names no type, a type the realm doesn’t accept or the client may not ask for, or fails its schema; no held template admits it; or a token request names an object the code, refresh token or approval doesn’t hold
invalid_requestauthorization_details sent on a request for an identity assertion
WhereFieldWhat it sets
Realm, oauth2SettingsauthorizationDetailsTypesThe types the realm accepts, each with its JSON Schema. None by default
ClientauthorizationDetailsTypesThe types this client may ask for, within the realm’s. None by default
EntitlementauthorizationDetailsThe templates it grants: a type, and a bound on each field
  • Remembered consent to the same objects, and objects carried through token exchange (today an exchanged token holds no authorization_details): see What’s next for authorization.