Expand description
Role-based access control policy engine and middleware. Role-Based Access Control (RBAC) policy engine.
Evaluates (role, operation, host) tuples against a set of role
definitions loaded from config. Deny-overrides-allow semantics:
an explicit deny entry always wins over a wildcard allow.
Includes an axum middleware that inspects MCP JSON-RPC tool calls and enforces RBAC and per-IP tool rate limiting before the request reaches the handler.
Structs§
- Argument
Allowlist - Per-tool argument allowlist entry.
- Rbac
Config - Top-level RBAC configuration (deserializable from TOML).
- Rbac
Policy - Compiled RBAC policy for fast lookup.
- Rbac
Policy Summary - Summary of the whole RBAC policy, produced by
RbacPolicy::summary. - Rbac
Role Summary - Summary of a single role, produced by
RbacPolicy::summary. - Role
Config - A single role definition.
Enums§
- Rbac
Decision - Result of an RBAC policy check.
Functions§
- current_
identity - Get the current caller’s identity name (set by RBAC middleware).
Returns
Noneoutside an RBAC-scoped request context. - current_
role - Get the current caller’s RBAC role (set by RBAC middleware).
Returns
Noneoutside an RBAC-scoped request context. - current_
sub - Get the JWT
subclaim (stable user ID, e.g. Keycloak UUID). ReturnsNoneoutside a request context or for non-JWT auth. Use for stable per-user keying (token store, etc.). - current_
token - Get the raw bearer token for the current request as a
SecretString. - with_
rbac_ scope - Run a future with all task-locals (
CURRENT_ROLE,CURRENT_IDENTITY,CURRENT_TOKEN,CURRENT_SUB) set. - with_
token_ scope - Run a future with
CURRENT_TOKENset so thatcurrent_token()returns the given value inside the future.