middleware

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package middleware contains the Chi middleware stack applied to every incoming HTTP request: CORS, Auth (JWT extraction), Rate Limit, and Permission (perm.Engine.CheckAction).

See PRD §12.2 and TAD §3.2 for the ordering specification. Implemented in Phase 6.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(provider auth.Provider) func(http.Handler) http.Handler

Auth middleware extracts authentication credentials from the Authorization header and injects auth.Identity into context.Context via auth.NewContext. The ?access_token= query parameter is accepted as a fallback so browsers can authenticate the agent WebSocket (TAD §6.2) without a custom header; it is never returned in URLs by the UI.

func CORS

func CORS(allowedOrigins []string) func(http.Handler) http.Handler

CORS handles Cross-Origin Resource Sharing based on configured allowed origins.

func Permission

func Permission(permEngine perm.Engine) func(http.Handler) http.Handler

Permission checks document-level CRUD permissions for REST endpoints using perm.Engine.

func RateLimit

func RateLimit(limit int, window time.Duration, store cache.Store) func(http.Handler) http.Handler

RateLimit creates rate limiting middleware per caller identity or remote IP.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL