middleware

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const RequestIDHeader = "X-Request-Id"
View Source
const (
	UserContextKey = "user"
)

Variables

This section is empty.

Functions

func GetUser

func GetUser(c *gin.Context) *model.User

GetUser retrieves the authenticated user from the context.

func Logging

func Logging() gin.HandlerFunc

func OptionalAuth

func OptionalAuth(authSvc *auth.Service) gin.HandlerFunc

func RequestID

func RequestID() gin.HandlerFunc

func RequireAuth

func RequireAuth(authSvc *auth.Service) gin.HandlerFunc

func RequireRole

func RequireRole(roles ...string) gin.HandlerFunc

func SecurityHeaders

func SecurityHeaders() gin.HandlerFunc

SecurityHeaders adds standard security headers to all responses.

func WebOptionalAuth

func WebOptionalAuth(authSvc *auth.Service) gin.HandlerFunc

WebOptionalAuth is an alias for OptionalAuth, used on web routes. It reads from both Authorization header and session_token cookie.

Types

type RateLimiter

type RateLimiter struct {
	// contains filtered or unexported fields
}

func NewRateLimiter

func NewRateLimiter(cfg config.RateLimitConfig) *RateLimiter

func (*RateLimiter) RateLimit

func (rl *RateLimiter) RateLimit(bucketType string) gin.HandlerFunc

Jump to

Keyboard shortcuts

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