POST /api/v1/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.
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.
Who the credential acts as. Send exactly one of localUser and subjectToken; both,
or neither, is 400 BAD_REQUEST.
localUser-- your application's own id for the user. The Gateway prefixes it with your registered service's prefix to build the XAuth identity.subjectToken-- the end user's access token, a JWT the operator's identity provider issued to this Gateway's API audience at the request of your service's own client (for example by an OAuth 2.0 token exchange, RFC 8693). The Gateway validates it itself -- the signature by the provider's published keys,alg, atypofat+jwt, the issuer, the audience, the times, and that the client it was issued to is one the operator bound to your service -- and maps the token's issuer and subject, through the operator's mapping, to ONE XAuth identity that must lie inside your service's prefix. An ID token is refused. Nothing in the token chooses the identity beyond that mapping, and the token itself is never forwarded, logged or returned. The credential expires no later than the token does.
Every refusal of a subjectToken is the Gateway's own and is answered before anything is
sent to the key server. From the mapped identity on, the request is checked and minted
exactly as a localUser one is, and the key server authorizes every operation the
credential makes against that identity.
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 | no | 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. Send this or subjectToken, never both. |
subjectToken | string | no | The end user's access token (a compact JWT) issued to this Gateway's API audience at the request of a client the operator bound to your service. The Gateway validates it and maps its issuer and subject to the identity the credential acts as. Send this or localUser, never both. |
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": "...",
"subjectToken": "...",
"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 | The localUser you sent. Absent when you sent subjectToken. |
identity | object | no | Present when you sent subjectToken: where the identity came from. Never the token and never its subject. |
service | string | no | |
delegator | string | no | |
ks | KsAddress | no | |
detail | string | yes |
identity object
| Field | Type | Required | Description |
|---|---|---|---|
source | "subjectToken" (constant) | no | |
issuer | string | no | The token's issuer. |
mappingRevision | integer | no | The revision of the operator's mapping that named the identity. |
KsAddress
| Field | Type | Required | Description |
|---|---|---|---|
host | string | no | |
port | integer | no |
Example
{
"session": "...",
"actingAs": "...",
"objects": [
"..."
],
"expiresAt": "...",
"expiresInMs": 0,
"mintedAt": "...",
"jkt": "...",
"localUser": "...",
"identity": {
"source": "subjectToken",
"issuer": "...",
"mappingRevision": 0
},
"service": "...",
"delegator": "...",
"ks": {
"host": "...",
"port": 0
},
"detail": "..."
}
400
BAD_REQUEST -- both localUser and subjectToken, or neither, or a subjectToken that is not a non-empty string; 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, a DPoP proof that did not verify, or a certificate session whose certificate the key server now refuses.
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.
CERTIFICATE_REVOKED -- on a session established by certificate login, the key server
re-checks the certificate that session was established with on its operations, and it
is now named by revocation evidence. detail is the key server's sentence. The
Gateway answers this once and then ENDS everything that service holds or minted here --
its sessions, the delegated sessions and the scoped credentials it minted -- so a later
operation on any of them is SESSION_NOT_FOUND. Log in with a different certificate.
SSO_SESSION_EXPIRED -- a single-sign-on session (POST /api/v1/session/oidc) reached
its lifetime, or was idle past its binding's idle bound; it has been ended. Sign in again.
SENDER_KEY_RETIRED -- the session's registered sender key was rotated out and its
overlap has passed (see "The registered service's credential lifecycle"); the session is
closed with this answer. SERVICE_REGISTRATION_ENDED -- the registration a service
credential was issued under was removed or narrowed on this Gateway; it has ended. Both
are final for that credential.
403
NOT_A_SERVICE_SESSION, SERVICE_NOT_REGISTERED, SERVICE_OPERATION_NOT_PERMITTED, DELEGATOR_NOT_PERMITTED, DELEGATOR_TOO_NARROW or TARGET_DISABLED. See POST /api/v1/session/delegated for what each means. With subjectToken, also: SUBJECT_TOKEN_REFUSED -- the token did not validate, whichever check it failed (one answer for all of them, so the response does not say which check to work around); obtain a fresh token issued to this Gateway's audience at your service's own client's request. IDENTITY_NOT_MAPPED -- the token is valid, but the operator has no enabled mapping of its issuer and subject to an identity inside your service's prefix. BINDING_NOT_AVAILABLE -- the operator has not enabled access tokens for your service; send localUser. Nothing was sent to the key server.
404
TARGET_NOT_FOUND -- create the target with POST /api/v1/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. With subjectToken, also OIDC_NOT_CONFIGURED -- this Gateway has no identity provider configured, so send localUser -- or IDP_UNAVAILABLE (Retry-After) -- the identity provider's signing keys could not be read just now; this is not a verdict on the token. Nothing was sent to the key server. Or CAPACITY_UNAVAILABLE (scope: process, Retry-After) -- this Gateway is at its request ceiling (see "Rate and capacity limits").
413
PAYLOAD_TOO_LARGE (retryable: false) -- the request body is larger than this
deployment accepts. It was refused before it was parsed, and the connection is closed.
Nothing was sent to the key server.
429
RATE_LIMITED (retryable: true, Retry-After) -- the allowance this request is charged
to is spent: the login allowance of its network source (before authentication), or the
allowance, the concurrency ceiling or the live-session ceiling of the identity it was
verified as -- shared by every session that identity holds, including every delegated
and scoped credential a service minted. It carries no scope. Nothing was sent to the
key server; on a login refused after authentication, the session it created has been
closed. See "Rate and capacity limits" above.
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 -- both localUser and subjectToken, or neither, or a subjectToken that is not a non-empty string; 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, a DPoP proof that did not verify, or a certificate session whose certificate the key server now refuses. 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. CERTIFICATE_REVOKED -- on a session established by certificate login, the key server re-checks the certificate that session was established with on its operations, and it is now named by revocation evidence. detail is the key server's sentence. The Gateway answers this once and then ENDS everything that service holds or minted here -- its sessions, the delegated sessions and the scoped credentials it minted -- so a later operation on any of them is SESSION_NOT_FOUND. Log in with a different certificate. SSO_SESSION_EXPIRED -- a single-sign-on session (POST /api/v1/session/oidc) reached its lifetime, or was idle past its binding's idle bound; it has been ended. Sign in again. SENDER_KEY_RETIRED -- the session's registered sender key was rotated out and its overlap has passed (see "The registered service's credential lifecycle"); the session is closed with this answer. SERVICE_REGISTRATION_ENDED -- the registration a service credential was issued under was removed or narrowed on this Gateway; it has ended. Both are final for that credential. |
403 | NOT_A_SERVICE_SESSION, SERVICE_NOT_REGISTERED, SERVICE_OPERATION_NOT_PERMITTED, DELEGATOR_NOT_PERMITTED, DELEGATOR_TOO_NARROW or TARGET_DISABLED. See POST /api/v1/session/delegated for what each means. With subjectToken, also: SUBJECT_TOKEN_REFUSED -- the token did not validate, whichever check it failed (one answer for all of them, so the response does not say which check to work around); obtain a fresh token issued to this Gateway's audience at your service's own client's request. IDENTITY_NOT_MAPPED -- the token is valid, but the operator has no enabled mapping of its issuer and subject to an identity inside your service's prefix. BINDING_NOT_AVAILABLE -- the operator has not enabled access tokens for your service; send localUser. Nothing was sent to the key server. |
404 | TARGET_NOT_FOUND -- create the target with POST /api/v1/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. With subjectToken, also OIDC_NOT_CONFIGURED -- this Gateway has no identity provider configured, so send localUser -- or IDP_UNAVAILABLE (Retry-After) -- the identity provider's signing keys could not be read just now; this is not a verdict on the token. Nothing was sent to the key server. Or CAPACITY_UNAVAILABLE (scope: process, Retry-After) -- this Gateway is at its request ceiling (see "Rate and capacity limits"). |
413 | PAYLOAD_TOO_LARGE (retryable: false) -- the request body is larger than this deployment accepts. It was refused before it was parsed, and the connection is closed. Nothing was sent to the key server. |
429 | RATE_LIMITED (retryable: true, Retry-After) -- the allowance this request is charged to is spent: the login allowance of its network source (before authentication), or the allowance, the concurrency ceiling or the live-session ceiling of the identity it was verified as -- shared by every session that identity holds, including every delegated and scoped credential a service minted. It carries no scope. Nothing was sent to the key server; on a login refused after authentication, the session it created has been closed. See "Rate and capacity limits" above. |