Signed request objects
The app signs its sign-in request with its own key, can encrypt it to the realm, and can have the answer posted back instead of placed in the address bar.
AvailableAPIRFC 9101, RFC 10070, OpenID Connect Core 1.0 §6, OAuth 2.0 Form Post Response Mode, RFC 7516, RFC 7518 §4.6
A signed request object is the app’s sign-in request as a JWT signed with the app’s own key. The realm reads only what is inside the signed part, so no one handling the URL can add to or change what the app asked for, even when the request travels through the browser. The app can also encrypt the object to the realm, so nothing that carries it can read it, and can have the code posted back to it rather than placed in the address bar.
- Sign when the app must prove the request is exactly its own, even if it travels through the browser.
- Encrypt when the request carries details no one on the way should read, and it travels through the browser. Inside a pushed request it already travels only between the app and the realm, so encryption adds little there.
- Form post when the app would rather not have the code in browser history or server logs.
Before you begin
Section titled “Before you begin”- Who can do it: a realm administrator (a group holding
RealmOwner) registers the client’s algorithms and keys;RealmViewercan read them. The app signs each request itself. - Where: today this is done through the API (Call the API shows how to get
$CVYUH_SESSION). - First: the app holds a signing key whose public half is in its
jwksor at itsjwksUri.
How it works
Section titled “How it works”The app puts the sign-in parameters in the claims of a JWT, beside the claims that say who sent it, to whom, and for how long:
{ "iss": "team-wiki", "aud": "https://foobar.cvyuh.com/oauth2", "client_id": "team-wiki", "nbf": <unix time>, "exp": <nbf + 300>, "jti": "4d6f1c2e-8b3a-4f9e-a1c7-5e2b9d0f7a31", "response_type": "code", "redirect_uri": "https://wiki.example.com/callback", "scope": "openid profile", "state": "af0ifjsldkj", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "code_challenge_method": "S256"}It signs the JWT with its own key, under the algorithm it registered, and sends it as request. The client_id
outside the object is still needed, because it tells the realm whose keys to check the signature with:
GET /oauth2/authorize?client_id=team-wiki&request=eyJhbGciOiJFUzI1NiIsImtpZCI6Indpa2ktMSJ9.eyJpc3MiOi…Host: foobar.cvyuh.comThe object can travel in the browser like this, or inside a pushed request.
Encryption. An encrypted request object is a signed one the app has also encrypted to the realm’s own key. The
realm opens it first and then checks it exactly as a signed one; encryption never stands in for the signature. Every
realm that signs tokens holds an encryption key of its own, never its signing key. It is published in the realm’s
key set (/oauth2/jwks) with "use": "enc" and "alg": "ECDH-ES".
Form post. To have the code posted back, the app sends response_mode=form_post, or puts
"response_mode": "form_post" among the object’s claims. Instead of a redirect with the code in the address bar, the
browser posts the code to the app’s registered address. It needs no setting.
Set it up
Section titled “Set it up”Set these on the client (https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Client; see Call the API):
| Where | Setting | What it does |
|---|---|---|
| Client | requestObjectSigningAlg | ES256, RS256 or PS256. A client with securityProfile fapi2 may name only ES256 or PS256. Without it, signed requests are refused |
| Client | jwks or jwksUri | The client’s public keys, to check the signature |
| Client | requestObjectEncryptionAlg | ECDH-ES, the one key agreement taken. Needs requestObjectSigningAlg |
| Client | requestObjectEncryptionEnc | A128GCM, A256GCM or A128CBC-HS256. Left out, A128CBC-HS256, as OpenID Connect Registration sets. Named only beside the key agreement |
What the user sees
Section titled “What the user sees”Nothing different with a good object. A refused one shows the realm’s error page, with invalid_request_object;
the user goes back to the app and tries again. With form post, the browser shows a brief page that posts the code
to the app.
Limits and defaults
Section titled “Limits and defaults”| Setting or limit | Default | Range |
|---|---|---|
requestObjectSigningAlg | none: signed requests refused | ES256, RS256, PS256 (ES256, PS256 under fapi2) |
requestObjectEncryptionAlg | none | ECDH-ES |
requestObjectEncryptionEnc | A128CBC-HS256 | A128GCM, A256GCM, A128CBC-HS256 |
Between nbf and exp | at most an hour |
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
request_not_supported | The client registered no requestObjectSigningAlg | Register the algorithm the app signs with |
invalid_request_object | aud isn’t the issuer alone, nbf or exp is missing or over an hour apart, the key isn’t registered, or a jti was reused | Check those claims; register the key |
invalid_request | No client_id outside the object | Send client_id as a parameter too |
Audit record
Section titled “Audit record”A request object writes no record of its own; the sign-in it starts writes LOGIN and its steps, and its code a
TOKEN_ISSUED record. Changes to the client’s algorithms are in Audit → Config.
Good to know
Section titled “Good to know”- The object must be signed with the algorithm the client registered, with the client’s own key.
- It must name the client as its sender and the realm as its only receiver.
issis the client;audis the realm’s issuer as a string, or an array holding the issuer alone, never the issuer beside another audience. - It must carry both a start (
nbf) and an expiry (exp), no more than an hour apart. client_idgoes outside the object as well. Aclient_idinside the object that differs from it is refused.- An object that carries a
jtiis accepted once. - An encrypted object is taken only from a client registered for encryption, under the one content encryption it registered, and must hold a signed object. An unsigned one inside is refused. A client registered for encryption may still send its object signed only.
- Every refused encrypted object gets the same answer,
invalid_request_object, whatever went wrong, so the answer says nothing about the key. - A form post goes only to an address the client registered.
- The realm’s encryption key is made when the realm is created; it is not rotated or revoked yet. The discovery
document lists
request_object_encryption_alg_values_supportedandrequest_object_encryption_enc_values_supportedonly while the realm holds one and takes the authorization code grant. - RSA key encryption (
RSA-OAEP) is not offered.
Reference
Section titled “Reference”Errors
Section titled “Errors”At /authorize, a refused object is shown on the realm’s error page. It is never sent to the app’s return address,
since nothing in an object that failed its checks can be trusted. Inside a pushed request, the same error is the
push’s answer.
| Error | When |
|---|---|
request_not_supported | The client registered no requestObjectSigningAlg |
invalid_request_object | The signature, a claim or the encryption doesn’t check out; the jti was used before; or the inner client_id differs |
invalid_request | The request carries no client_id outside the object |
Related
Section titled “Related”- Make sign-in requests tamper-proof: signing and pushing requests, start to finish.
- Pushed authorization requests: keep the request out of the browser entirely.
- Security profiles: which algorithms a FAPI 2.0 client may sign with.
- Discovery document: where the realm’s encryption key is published.