Skip to main content

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. objects is 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). senderKey is 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.

This surface sets no cookie

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

FieldTypeRequiredDescription
localUserstringyesYour 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.
objectsarray of stringyesCanonical base64 object identifier -- the same hidden links the key routes take. A zero-length one names no object and is not a wildcard.
senderKeyobjectyesThe 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.

FieldTypeRequiredDescription
sessionstringyesThe bearer credential.
actingAsstringyes
objectsarray of stringyes
expiresAtstringyes
expiresInMsintegerno
mintedAtstringno
jktstringyesRFC 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.
localUserstringno
servicestringno
delegatorstringno
ksKsAddressno
detailstringyes

KsAddress

FieldTypeRequiredDescription
hoststringno
portintegerno

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 codedetail is written for a human debugging the call and its wording is not part of the contract. See the error model.

StatusMeaning
400BAD_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.
401No 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.
403NOT_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.
404TARGET_NOT_FOUND -- create the target with POST /api/principals/xauth and retry.
500A 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.
503SCOPED_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.