Skip to main content

Module admin

Module admin 

Source
Expand description

Admin diagnostic endpoints (status, auth keys metadata, counters, RBAC). Admin diagnostic endpoints.

When enabled, the server exposes a small /admin/* surface that returns read-only diagnostic JSON: uptime, active auth configuration (no secrets), auth counters, and an RBAC policy summary.

The admin router is always wrapped in the existing auth + RBAC stack and additionally requires the caller’s role to match the role field on crate::admin::AdminConfig. Configuration validation refuses to enable admin without auth.

§Cancel safety

Admin handlers are cancel-safe with respect to admin state: they only read in-memory Arc / ArcSwap state and build JSON responses. crate::admin::require_admin_role performs its role check before next.run(req).await and holds no guard, lock, or permit across that await; downstream route cancel safety is inherited from Axum and the selected route.

Structs§

AdminConfig
Admin endpoint configuration.
AdminStatus
/admin/status response body.

Functions§

require_admin_role
Role-check middleware for admin routes.