Factory method building a scoped RbacRequestContext helper for controllers and templates.
Current user context (or null for anonymous guest).
RbacRequestContext instance.
Normalizes the target URI and HTTP method from the Astro context.
The Astro request context.
Object containing the normalized URI and HTTP method.
Extracts the authenticated user context from the Astro context.
The Astro request context.
The resolved RbacUserContext or null if unauthenticated.
Handles access denial by returning JSON for API endpoints or a redirect Response for HTML pages.
The Astro request context.
Response placeholder.
Denial rationale ('unauthenticated' | 'forbidden' | 'tarpit_blocked').
Astro standard Response.
Produces standard Astro middleware handler function.
Astro middleware implementing Quatrain RBAC route guards, FLS context injection and tarpit delays. Unifies API endpoints (JSON responses) and SSR pages (redirects / forbidden status).