Identity tokens are a v1alpha2 feature. Enable with
spec.identity.enabled: true in your policy.Token Structure
AIP Identity Tokens are JWT-like structures with the following fields:Token Claims
Token format version. Must be
"aip/v1alpha2".Intended audience (from
identity.audience or metadata.name).Purpose: Prevents tokens issued for one MCP server from being accepted by another.Example: "https://mcp.example.com/api"SHA-256 hash of the canonical policy document.Format: 64-character lowercase hex stringPurpose: Ensures token is bound to a specific policy version.Example:
"a3c7f2e8d9b4f1e2c8a7d6f3e9b2c4f1a8e7d3c2b5f4e9a7c3d8f2b6e1a9c4f7"UUID identifying this agent session.Format: UUID v4Purpose: Links related audit events and enables session revocation.Example:
"550e8400-e29b-41d4-a716-446655440000"Value of
metadata.name from the policy.Example: "production-agent"Token issuance time.Format: ISO 8601 with milliseconds (UTC)Example:
"2026-01-24T10:30:00.000Z"Token expiration time.Format: ISO 8601 with milliseconds (UTC)Constraint:
expires_at = issued_at + token_ttlExample: "2026-01-24T10:35:00.000Z" (5 minutes after issuance)Random value for replay prevention.Format: Hexadecimal string (32+ characters recommended)Purpose: Prevents token reuse. Nonces are tracked and rejected if seen twice.Example:
"a1b2c3d4e5f6789012345678abcdef01"Session binding context (see Binding Object).
Binding Object
Thebinding object ties tokens to their execution context, preventing token theft across processes/hosts.
OS process ID of the AIP engine.Checked when:
session_binding: "process" or "strict"Absolute path to the policy file.Example:
"/etc/aip/agent-policy.yaml"Normalized hostname (see Hostname Normalization).Checked when:
session_binding: "strict"Example: "k8s:550e8400-e29b-41d4-a716-446655440000" (Kubernetes pod UID)Docker/containerd container ID (first 12 characters).Present when: Running in a container
Kubernetes pod UID.Present when: Running in Kubernetes
Hostname Normalization
Hostnames are normalized for consistent binding across environments:| Environment | Hostname Value | Example |
|---|---|---|
| Kubernetes | k8s:<pod-uid> | k8s:550e8400-e29b-41d4-a716-446655440000 |
| Docker | container:<id> | container:abc123def456 |
| Bare metal/VM | FQDN | worker-1.example.com |
| Serverless | lambda:<request-id> | lambda:req-abc123 |
POD_UIDenvironment variable (Kubernetes)- Container ID from
/proc/1/cpusetor cgroup - FQDN (if hostname contains
.) - Short hostname + domain from
/etc/resolv.conf - Short hostname
Token Encoding
Tokens are encoded as RFC 7519 JWTs whenserver.enabled: true (REQUIRED for server mode).
JWT Header
Signing algorithm.Supported algorithms (in order of preference):
ES256(ECDSA P-256 + SHA-256) - RECOMMENDED for productionEdDSA(Ed25519) - RECOMMENDED for performanceES384(ECDSA P-384 + SHA-384) - High-security environmentsRS256(RSA 2048+ + SHA-256) - Legacy compatibilityHS256(HMAC-SHA256) - Local-only, NOT for server mode
Token type. Must be
"aip+jwt".Key ID for signature verification.Purpose: Allows key rotation. Clients fetch public keys from JWKS endpoint.
JWT Payload
The payload contains the token claims documented above.JWT Signature
Tokens are signed using the algorithm specified in the header. Implementations MUST verify:- Signature is valid for the token header + payload
- Signing key matches the
kidin JWKS - Algorithm matches policy configuration
Token Lifecycle
1. Token Issuance
Tokens are issued when:- Session starts (first tool call with
identity.enabled: true) - Rotation interval elapsed
- Policy changes (new
policy_hash)
- Generate random nonce (32+ bytes)
- Compute policy hash from canonical policy
- Set
expires_at = now() + token_ttl - Sign token with current signing key
- Log
TOKEN_ISSUEDevent to audit log
2. Token Rotation
Rotation creates a new token while the old token is still valid (grace period). Rotation process:- Check if
now() > issued_at + rotation_interval - Generate new nonce
- Issue new token with same
session_id - Log
TOKEN_ROTATEDevent - Old token remains valid until
expires_at
3. Token Validation
Every request with a token undergoes validation: Validation steps:- Check revocation (session or nonce in revocation list)
- Check expiration (
now() <= expires_at) - Check audience (
audmatchesidentity.audience) - Check policy hash (
policy_hashmatches current policy or in grace period) - Check session binding (based on
session_bindingmode) - Check nonce (not seen before, atomic check-and-record)
- Verify signature (JWT signature valid for payload)
-32009 (Token Invalid) with specific token_error value.
4. Token Revocation
Tokens can be revoked before expiration: Revocation types:- Session revocation: Invalidate all tokens for a
session_id - Token revocation: Invalidate specific token by
nonce
Session Binding Modes
Thesession_binding policy field controls how strictly tokens are bound to execution context.
| Mode | Checks | Use Case |
|---|---|---|
process | Process ID | Single-machine, local agents |
policy | Policy hash only | Distributed agents sharing policy |
strict | Process + policy + hostname | High security, non-ephemeral |
Process Mode (Default)
Validation: Token’sbinding.process_id must match current process.
Use case: Local agents running as single process.
Configuration:
Policy Mode
Validation: Token’spolicy_hash must match current policy (or be in grace period).
Use case: Distributed agents (Kubernetes, serverless) where process ID changes.
Configuration:
Strict Mode
Validation: Token’sbinding must exactly match current:
process_idpolicy_hashhostnamecontainer_id(if present)pod_uid(if present)
JWKS Endpoint
Whenserver.enabled: true, the JWKS (JSON Web Key Set) endpoint exposes public keys for token verification.
Request:
- Clients SHOULD cache JWKS responses (default: 1 hour)
- Clients MUST refresh JWKS when encountering unknown
kid
Security Considerations
Token Theft Prevention
- Short TTL: Use 5-15 minute
token_ttlto limit theft window - Session binding: Prevents token use on different processes/hosts
- Nonce tracking: Prevents token replay
- TLS transport: Always use HTTPS for token transmission
Key Rotation
Rotate signing keys periodically (default: 7 days):- Generate new key, add to JWKS
- New tokens signed with new key
- Old key remains in JWKS for
token_ttlduration - Remove old key from JWKS
Key Compromise Response
If a signing key is compromised:- Immediate: Remove compromised key from JWKS
- Generate: Create new signing key
- Revoke: Revoke all sessions that used compromised key
- Rotate: Force token rotation for all active sessions
- Audit: Log compromise event with forensic details
Example Configurations
Next Steps
Policy YAML
Configure identity settings in policy
Error Codes
Token validation error codes
Audit Format
Identity event logging
Server API
JWKS and revocation endpoints