serve only.Expand description
Role-based access control for the faucet serve control plane (#205).
The default single---auth-token mode is one implicit admin principal. A
--auth-config <file> promotes serve to a multi-principal deployment: a list
of { name, token, role } principals, each token mapped to a Role that
grants a fixed set of Permissions. Every /v1 route declares the
permission it needs (required_permission); the auth middleware
(serve::auth::require_auth) resolves the bearer token to an
AuthContext and denies (403) any request whose role lacks the permission.
Tokens are compared in constant time (via serve::auth::constant_time_eq)
and never appear in {:?} output — PrincipalSpec’s Debug masks them,
and the server registers every token with the redaction writer at startup.
Structs§
- Auth
Context - The resolved identity for one request, carried in the request extensions for handlers (and the audit writer) to read. Holds no token.
- Principal
Spec - One principal entry in an
--auth-configfile: a human-readablename, its bearertoken, and theroleit is granted. - Rbac
Config - A validated RBAC configuration: a non-empty set of principals with unique names and unique, non-empty tokens.
Enums§
- Permission
- A discrete capability a route requires. Roles grant a fixed set of these.
- Role
- A named role. Roles are a fixed, built-in ladder —
viewer⊂operator⊂admin— chosen so the common cases (read-only dashboard user, run operator, full admin) need no custom permission wiring.
Functions§
- audit_
action - A short, stable audit action label for a
(method, matched-route)pair. - required_
permission - The permission a
(method, matched-route-template)pair requires.Nonemeans the route has no specific mapping and is therefore admin-only (fail closed for any route added without an explicit entry here).