Authentication
How agents authenticate to the gateway with signed requests and how humans authenticate to the control plane with bearer sessions.
AgentShield authenticates two kinds of callers with two different mechanisms. They are never interchangeable.
| Caller | Service | Mechanism | Lifetime |
|---|---|---|---|
| Agent | Gateway (:8081) | Ed25519 signature over each request body | Per request, 60-second window |
| Human | Control plane (:8080) | Authorization: Bearer <token> session | 12 hours, revocable |
Agents
Agents do not have tokens. Every request to /api/v1/runtime/authorize and /api/v1/runtime/execute carries four headers:
X-AgentShield-Agent-Id: 3f2b8c1e-6a4d-4f7e-9b21-5c8d0e7a4b13
X-AgentShield-Timestamp: 1764504000
X-AgentShield-Nonce: hQ3xR8pV2mK9sT4wZ7yB1c
X-AgentShield-Signature: 2Pq...base64url...XwThe gateway authenticates the request in this order. Each failure stops the request before policy runs:
| Check | Failure response |
|---|---|
No Authorization header (human sessions are refused here) | 401 unauthenticated |
| Body present and valid JSON with no duplicate keys | 400 validation_failed |
| All four headers present | 401 "agent signature headers are required" |
| Agent id is a UUID, timestamp is an integer | 401 "authentication failed" |
| Agent exists | 401 "authentication failed" |
| Nonce shape, timestamp within 60 s, signature verifies | 401 "authentication failed" |
| Nonce not used by this agent in the last 130 s | 401 "nonce already used" |
Failures share one message on purpose. A caller cannot tell an unknown agent from a wrong key or a skewed clock.
Unauthenticated requests produce no decision record because there is no verified principal to attribute them to. They are counted in the gateway's HTTP metrics.
See Request signing for the exact signing input and Replay protection for nonce handling.
Humans
Members sign in with email and password:
curl -s http://127.0.0.1:8080/api/v1/sessions \
-H "Content-Type: application/json" \
-d '{"email":"owner@example.com","password":"change-me-local-only"}'{
"token": "…",
"token_type": "bearer",
"expires_at": "2026-12-01T00:00:00.000Z",
"organization_id": "9a7e5d2c-1b3f-4c6a-8e0d-2f4b6a8c0e1d",
"password_change_required": false
}- Passwords are stored as Argon2id hashes. Passwords must be 12–128 characters.
- The token is returned once. The control plane stores only its SHA-256.
- Sessions expire after 12 hours.
DELETE /api/v1/sessions/currentends a session on the server. - Changing a password with
POST /api/v1/sessions/current/passwordends the user's other sessions. - Disabling a member ends their sessions.
Temporary passwords
When mail is not configured, a new member receives a one-time temporary password. A session created with it has password_change_required: true, and every route except reading the session, signing out, and changing the password returns 403 password_change_required.
Invitations
With SMTP_URL configured, new members receive an emailed single-use link that expires after 72 hours. The token travels in the URL fragment so it never reaches server logs, and only its SHA-256 is stored. Every unknown, used, or expired token receives the same 404.
Roles
A session carries the member's role in their organization. Roles gate control plane routes:
| Capability | owner | admin | operator | auditor | approver |
|---|---|---|---|---|---|
| Register agents | ✓ | ✓ | ✓ | ||
| Suspend, resume, revoke, rotate agents | ✓ | ✓ | |||
| Create and edit policies | ✓ | ✓ | |||
| List, approve, reject approvals | ✓ | ✓ | ✓ | ||
| List events, reliability metrics | ✓ | ✓ | ✓ | ✓ | |
| Audit links and head exports, incidents, alerts, evidence | ✓ | ✓ | ✓ | ||
| Acknowledge or resolve alerts | ✓ | ✓ | |||
| Members and invitations | ✓ | ✓ | |||
| Chaos experiments | ✓ | ✓ |
Any authenticated member can list agents and policies and read their own session. The dashboard mirrors this table to hide actions a role cannot use; the control plane still enforces every rule.
Implementation references
Was this page helpful?
Trust Boundaries
Where AgentShield draws its trust boundaries, which inputs are treated as claims, and which components are allowed to make which decisions.
Request Signing
The AgentShield v1 request signature. The exact signing input, header encoding, verification rules, and how to implement it in another language.