Advanced OAuth
Rich Authorization Requests (RFC 9396)
On this page
Introduction
An application asks for permission with scope, which is a list of bare strings
(see scope). So everything an API needs to say about a
permission has to be encoded into one of them. That works until a permission has
structure: move £500 from this account to that one, sign this document,
issue this credential. At that point deployments invent
payment:500:GB123:GB456, and every party has to agree how to split it.
Rich Authorization Requests (RAR), defined in RFC 9396, give the permission a
shape instead. authorization_details is a JSON array of typed objects saying
what may be done, where, and to what. Signari checks each object strictly, shows
it on the consent screen, and carries it into the tokens it issues.
You register the types of detail your APIs understand with
signari rar register, and allow each application its types with
signari rar allow.
An example request
An application asking to initiate a payment from one account, and check its status, sends this:
TextGET /oauth2/authorize ?response_type=code&client_id=…&redirect_uri=… &authorization_details=[{"type":"payment_initiation", "actions":["initiate","status"], "identifier":"acct-1"}]
Why it is implemented
- OWASP ASVS 5.0 V10.3.2, from the Application Security Verification
Standard, requires the resource server to enforce
authorization_details"if present". Without support for the parameter, there was nothing to enforce. - OpenID for Verifiable Credential Issuance (OID4VCI), in §6.2, prefers
authorization_detailsover scope for naming which credential configurations a token authorises.
Unknown fields are refused
RFC 9396 §5 requires the authorization server to refuse an object "of known type but containing unknown fields".
That is the opposite of the rule elsewhere in Signari. AuthZEN §10.1.1 makes
ignoring unknown fields a MUST, and internal/authzen does that.
The two rules differ because the fields mean different things. An unknown field in an authorization query is a hint the decision did not need. An unknown field in an authorization detail is a permission.
Ignoring it either grants access the person never saw on the consent screen, or withholds one the application believes it obtained. Neither failure is visible when it happens.
All five of §5's conditions are enforced, each with its own test:
| §5 condition | Rejected |
|---|---|
| unknown authorization details type | ✅ |
| known type containing unknown fields | ✅ |
| fields of the wrong type | ✅ |
| fields with invalid values | ✅ (empty values; see the limit below) |
| missing required fields | ✅ |
Type registration, which the RFC leaves open
§10: "The registration of authorization details types with the AS is outside the scope of this specification." AS is the authorization server. So Signari defines its own registration.
These commands register the payment_initiation type, allow the wallet
application to request it, and list the types:
Shellsignari rar register -org <uuid> -type payment_initiation \ -fields actions,identifier -required actions,identifier \ -describe "Initiate and check a payment"signari rar allow -client-id wallet -type payment_initiationsignari rar list
Registration has two constraints:
- Only §2.2's common data fields (
locations,actions,datatypes,identifier,privileges) may be declared. A field outside that set could never be validated, so the registration would accept anything in it. - Registration declares fields, not value schemas. §2.2 says the allowable values "are determined by the API being protected", which Signari cannot know. So Signari checks only emptiness and JSON type.
An application must also be allowed a type explicitly. It is an allow-list rather than "any registered type", for the same reason group release is one. Otherwise an application could request every permission the deployment has defined.
A type this application may not request is treated as an unknown type (§5's first condition) and refused, not dropped. A dropped permission would produce a token weaker than the consent screen described, and the difference would show only when something failed in production.
Consent for each transaction
Consent is recorded per scope name, and a detail carries the particulars of one
transaction. A person who once approved the scope payments approved a
capability, and never a payment.
So no stored grant satisfies a detail, and a request with details always shows the consent screen. Otherwise one approval would approve every later transfer, of any amount to any account, with no screen at all. Details are checked before the first-party exemption, since a trusted relationship cannot vouch for a transaction that did not exist when it was established.
The screen shows each detail beside the scopes. When the person presses Allow, the same request carries on and ends in an authorization code, with the approval held inside Signari. No URL carries the approval, because anything that could say so in a URL, an application could write there.
A request can carry details and no scope at all, as RFC 9396 and OID4VCI's own example both do.
Narrowing at the token endpoint
§6 lets a token request ask for less than was granted. §6.1 says that no standard comparison exists: "the semantics of the fields in the authorization_details will be implementation specific" and "an AS should not rely on simple object comparison in most cases".
So Signari implements the one comparison that is safe without knowing the API:
subset containment. A requested detail is allowed when a granted detail of the
same type contains every one of its values, field by field. identifier is
compared for equality, since it is a scalar.
That can only narrow, never widen, which is what §6 requires. Any other comparison would need Signari to know what the fields mean, which §6.1 says it cannot.
What is returned, and from where
§7: "the AS MUST also return the authorization_details as granted by the resource owner and assigned to the respective access token."
They are read back from the authorization code, never from a parameter the application resends at the token endpoint. Otherwise an application could change them by resending them. They are carried on the refresh family too, so a refreshed token does not differ from the first one.
A grant with no rich permissions omits the field entirely, rather than sending an empty array. An application that never asked should not have to distinguish "you got nothing" from "this server does not do that".
§9 adds: "the AS MUST make this data available to the RS." RS is the resource server. The token response of §7 goes to the application, the party being constrained, and the resource server that does the constraining never sees it. So the details also travel in two more places:
- as a top-level
authorization_detailsclaim in the access token, a JSON Web Token (JWT), under §9.1; - as a top-level member of the introspection response, under §9.2.
The claim is filtered by locations, so one resource server does not learn what
was granted for another. A detail with no locations reaches every resource
server. locations is OPTIONAL under §2.2, so its absence means unspecified,
not applies nowhere.
Advertising supported types
§10's authorization_details_types_supported is populated from what is
registered, so a deployment with no types advertises nothing. Signari applies the
same rule to registration_endpoint, because a client will try to use any
capability named in a metadata document.
Limits
- Value semantics are not validated, only presence, JSON type and emptiness. The RFC says values are the API's business. A resource server still has to enforce what the values mean.
- Enrichment (§7.1), the authorization server adding fields to a granted detail, is not implemented.
- Consent rendering shows the type, actions and identifier. Under §3, the AS "MUST present the merged set of requirements" when scope and authorization_details are combined. That is met by showing both, not by merging them into one sentence.
Changed Signari v0.2