Documentation
¶
Index ¶
- func AuthenticationMiddleware(next http.Handler, authenticator security.Authenticator, ...) http.Handler
- func ContextSetupMiddleware(mainCtx context.Context, next http.Handler, ...) http.Handler
- func FunctionAccessMiddleware(next http.Handler, checker *authorizer.FunctionChecker, ...) http.Handler
- func LoggingMiddleware(next http.Handler, logBody bool) http.HandlerFunc
- func TenancyAccessMiddleware(next http.Handler, checker *authorizer.TenancyAccessChecker) http.Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticationMiddleware ¶
func AuthenticationMiddleware( next http.Handler, authenticator security.Authenticator, opts ...security.AuthOption, ) http.Handler
AuthenticationMiddleware is an HTTP middleware that verifies and extracts authentication data supplied in a JWT as an Authorization bearer token.
func ContextSetupMiddleware ¶
func ContextSetupMiddleware( mainCtx context.Context, next http.Handler, ctxFnList ...func(ctx context.Context) context.Context, ) http.Handler
ContextSetupMiddleware propagates logger in main context into HTTP context.
func FunctionAccessMiddleware ¶ added in v1.82.0
func FunctionAccessMiddleware( next http.Handler, checker *authorizer.FunctionChecker, permissions map[string][]string, ) http.Handler
FunctionAccessMiddleware is an HTTP middleware that enforces functional permissions based on a mapping of HTTP path patterns to required permissions.
The permissions map keys are HTTP path prefixes (e.g., "/api/profiles") and values are slices of permission strings that must ALL be satisfied (AND logic).
If a request path matches multiple prefixes, the longest matching prefix is used. If no prefix matches, the request is allowed through without a permission check.
This middleware should be placed after AuthenticationMiddleware and TenancyAccessMiddleware in the handler chain.
func LoggingMiddleware ¶
func LoggingMiddleware(next http.Handler, logBody bool) http.HandlerFunc
LoggingMiddleware — zero-alloc hot path, panic-safe, production-grade.
func TenancyAccessMiddleware ¶ added in v1.76.1
func TenancyAccessMiddleware(next http.Handler, checker *authorizer.TenancyAccessChecker) http.Handler
TenancyAccessMiddleware is an HTTP middleware that verifies the caller has data access to the partition identified in their claims. It uses TenancyAccessChecker.CheckAccess which checks the "member" relation for regular users and the "service" relation for system_internal callers.
This middleware should be placed after AuthenticationMiddleware in the handler chain so that claims are available in the context.
Types ¶
This section is empty.