middleware

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const AuthUserID = authUserKey("middleware.auth.userID")

Variables

This section is empty.

Functions

func EnsureAuthMiddleware

func EnsureAuthMiddleware(next http.Handler) http.Handler

Middleware to ensure that the user is authenticated Ensure that "ParseAuthMiddleware" is called before this or a 401 will be returned every single time.

func ParseAuthMiddleware

func ParseAuthMiddleware(next http.Handler) http.Handler

Middleware to pass the user id in the context This middleware will NOT return a 401. It will only attempt to parse the userId from the Authorization header (if any).

Use EnsureAuthMiddleware after this middleware to raise a 401

func RateLimiterMiddleware

func RateLimiterMiddleware(next http.Handler) http.Handler

func RequestLogger

func RequestLogger(next http.Handler) http.Handler

Types

type Middleware

type Middleware func(http.Handler) http.Handler

func CreateStack

func CreateStack(stack ...Middleware) Middleware

To create a stack of middlewares more cleanly

Jump to

Keyboard shortcuts

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