middleware

package
v0.5.16 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyLimit added in v0.5.15

func BodyLimit(maxBytes int64) gin.HandlerFunc

BodyLimit rejects requests whose body exceeds maxBytes before any downstream binding reads it, so unauthenticated or semi-trusted routes cannot be used to exhaust memory with oversized payloads.

func InitJWT

func InitJWT() *jwt.GinJWTMiddleware

func InstanceJWT

func InstanceJWT() *jwt.GinJWTMiddleware

func RateLimiter added in v0.5.15

func RateLimiter(rps rate.Limit, burst int) gin.HandlerFunc

RateLimiter throttles requests per client IP with a token-bucket limiter, as a coarse safety net across every route (BodyLimit bounds one request's body, not how many requests run at once). rps is the sustained rate, burst the number of requests allowed instantly.

func RequireCapabilities added in v0.4.5

func RequireCapabilities(capability string) gin.HandlerFunc

RequireCapabilities ensures the current user has the requested capability server-side.

func RequireSuperAdmin added in v0.4.5

func RequireSuperAdmin() gin.HandlerFunc

RequireSuperAdmin middleware validates super admin bearer token with constant-time comparison

func ResetJWTMiddleware added in v0.4.5

func ResetJWTMiddleware()

ResetJWTMiddleware clears the cached JWT middleware instance. Used primarily in tests to force reinitialization with a different configuration.

Types

This section is empty.

Jump to

Keyboard shortcuts

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