POST /api/session/scoped
Mint a short-lived, object-scoped, key-bound credential for a browser. Guarded.
Mints a second, narrower credential for an end user's page. The caller must already hold
a certificate-login session belonging to a registered service permitted for the
session:scoped operation -- this is a door behind a door, which is why it needs no
unauthenticated exemption even though it mints a session.
The credential differs from every other on this surface in three ways:
- it names an explicit object list and reaches nothing else.
objectsis required and must be non-empty. An omitted list is refused rather than read as "no restriction": treating an absent list as "everything" would hand a browser the widest credential in the system at the moment the caller believed they were narrowing it; - it expires in minutes, and use does not extend it. An idle timeout would be refreshed by exactly the traffic a stolen handle produces;
- it is bound at mint time to a key the page holds and cannot be minted unbound
(ADR-0036).
senderKeyis required.
WARNING: the object scope is not an authorization decision and does not widen anything. It can only ever SUBTRACT. Whether the principal this credential acts as may reach a given object is the key server's answer, taken on every operation, every time -- nothing here pre-empts, duplicates or caches it.
senderKey is the PUBLIC half of a keypair the page generated, as a JWK. Generate the
private half non-extractable. A JWK carrying private material is refused, and the key
must then be considered disclosed.
Authentication
Send the session id as Authorization: Bearer <session id>, and an RFC 9449 DPoP proof in the DPoP header if your session is bound to a key. The two are required together, not as alternatives — see Authenticating and Proving you hold your key.
There is no session cookie on any response and none is read on any request. Do not set credentials: "include" on a browser fetch.
Request
| Field | Type | Required | Description |
|---|---|---|---|
localUser | string | yes | Your application's own user id. The Gateway prefixes it to build the XAuth identity, exactly as for a delegated session; you cannot name that identity. |
objects | array of string | yes | Canonical base64 object identifier -- the same hidden links the key routes take. A zero-length one names no object and is not a wildcard. |
senderKey | object | yes | The PUBLIC half of the page's keypair, as a JWK. P-256 (ES256) is what a browser generates; RSA is also accepted. Must carry the members RFC 7638 needs for a thumbprint. |
Example
{
"localUser": "...",
"objects": [
"..."
],
"senderKey": {}
}
Responses
200
A scoped, bound credential.
| Field | Type | Required | Description |
|---|---|---|---|
session | string | yes | The bearer credential. |
actingAs | string | yes | |
objects | array of string | yes | |
expiresAt | string | yes | |
expiresInMs | integer | no | |
mintedAt | string | no | |
jkt | string | yes | RFC 7638 thumbprint of the key this credential is bound to. Check it against your own key to confirm the Gateway bound the one you meant. |
localUser | string | no | |
service | string | no | |
delegator | string | no | |
ks | KsAddress | no | |
detail | string | yes |
KsAddress
| Field | Type | Required | Description |
|---|---|---|---|
host | string | no | |
port | integer | no |
Example
{
"session": "...",
"actingAs": "...",
"objects": [
"..."
],
"expiresAt": "...",
"expiresInMs": 0,
"mintedAt": "...",
"jkt": "...",
"localUser": "...",
"service": "...",
"delegator": "...",
"ks": {
"host": "...",
"port": 0
},
"detail": "..."
}
400
BAD_REQUEST -- objects absent, empty, over the per-credential limit, or carrying a zero-length entry; or senderKey absent, not a JWK object, of a key type this Gateway cannot bind, missing a member RFC 7638 requires, or carrying private key material. Or CALLER_SUPPLIED_IDENTITY.
401
No live session, or a DPoP proof that did not verify.
SESSION_NOT_FOUND -- the credential names no session this Gateway holds.
SESSION_EXPIRED -- it aged out. Both carry reauth: true; obtain a new credential
rather than retrying.
PROOF_* -- the sender constraint refused. See the DPoP section of this document for the
full table; PROOF_MALFORMED is a 400 and PROOF_REPLAY_CACHE_FULL a 503, and the
rest are here.
SCOPED_CREDENTIAL_EXPIRED -- a scoped browser credential passed its fixed lifetime. Use
does not extend it: an idle timeout would be refreshed by exactly the traffic a stolen
handle produces.
403
NOT_A_SERVICE_SESSION, SERVICE_NOT_REGISTERED, SERVICE_OPERATION_NOT_PERMITTED, DELEGATOR_NOT_PERMITTED or DELEGATOR_TOO_NARROW. See POST /api/session/delegated for what each means.
404
TARGET_NOT_FOUND -- create the target with POST /api/principals/xauth and retry.
500
A fault rather than a refusal.
OP_FAILED is the catch-all: the key server refused in words that match no classified
pattern, so the Gateway cannot say more than that the operation did not happen. Some key
server refusals that are conceptually a caller error arrive here rather than as a 4xx,
because the wire carries no distinguishing code -- where a route can recognise one from
its message it maps it, and each such mapping is documented on the operation.
503
SCOPED_CREDENTIAL_LIMIT -- this Gateway holds its maximum of live scoped credentials; they expire within minutes, or revoke one. Or DELEGATION_NOT_CONFIGURED / MAJORDOMO_NOT_CONFIGURED / SERVICE_REGISTRY_NOT_CONFIGURED. Nothing was sent to the key server.
Error handling
Every failure answers JSON carrying at least code and detail. Match on code — detail is written for a human debugging the call and its wording is not part of the contract. See the error model.
| Status | Meaning |
|---|---|
400 | BAD_REQUEST -- objects absent, empty, over the per-credential limit, or carrying a zero-length entry; or senderKey absent, not a JWK object, of a key type this Gateway cannot bind, missing a member RFC 7638 requires, or carrying private key material. Or CALLER_SUPPLIED_IDENTITY. |
401 | No live session, or a DPoP proof that did not verify. SESSION_NOT_FOUND -- the credential names no session this Gateway holds. SESSION_EXPIRED -- it aged out. Both carry reauth: true; obtain a new credential rather than retrying. PROOF_* -- the sender constraint refused. See the DPoP section of this document for the full table; PROOF_MALFORMED is a 400 and PROOF_REPLAY_CACHE_FULL a 503, and the rest are here. SCOPED_CREDENTIAL_EXPIRED -- a scoped browser credential passed its fixed lifetime. Use does not extend it: an idle timeout would be refreshed by exactly the traffic a stolen handle produces. |
403 | NOT_A_SERVICE_SESSION, SERVICE_NOT_REGISTERED, SERVICE_OPERATION_NOT_PERMITTED, DELEGATOR_NOT_PERMITTED or DELEGATOR_TOO_NARROW. See POST /api/session/delegated for what each means. |
404 | TARGET_NOT_FOUND -- create the target with POST /api/principals/xauth and retry. |
500 | A fault rather than a refusal. OP_FAILED is the catch-all: the key server refused in words that match no classified pattern, so the Gateway cannot say more than that the operation did not happen. Some key server refusals that are conceptually a caller error arrive here rather than as a 4xx, because the wire carries no distinguishing code -- where a route can recognise one from its message it maps it, and each such mapping is documented on the operation. |
503 | SCOPED_CREDENTIAL_LIMIT -- this Gateway holds its maximum of live scoped credentials; they expire within minutes, or revoke one. Or DELEGATION_NOT_CONFIGURED / MAJORDOMO_NOT_CONFIGURED / SERVICE_REGISTRY_NOT_CONFIGURED. Nothing was sent to the key server. |