Skip to main content

Module ctx

Module ctx 

Source
Expand description

The framework request context a facade method may receive as &Ctx.

A facade/controller method can take a &Ctx parameter (recognised and skipped from the wire by #[seiva::controller], ADR 0006): the transport injects it, carrying the authenticated Principal. A handler reads the caller’s tenant and permissions from it to scope data server-side — the tenant is never taken from the request body (OWASP API1). Ctx is itself an axum extractor (infallible: no principal in scope → Principal::anonymous), so the generated handler builds one from the request’s extensions.

It also carries the request’s operation coordinates (method + path) and the optional, validated Idempotency-Key (ADR 0011), so a write handler can fold the durable idempotency key + fingerprint inside its transaction without the controller macro having to grow a new parameter.

Structs§

Ctx
The request context handed to a facade method’s &Ctx parameter: the authenticated caller (tenant + permissions) plus the operation coordinates and an optional idempotency key.