middleware

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionUserID = "user_id"
)

Variables

This section is empty.

Functions

func CSRFMiddleware added in v0.2.0

func CSRFMiddleware() gin.HandlerFunc

CSRFMiddleware provides CSRF protection for state-changing operations

func GetCSRFToken added in v0.2.0

func GetCSRFToken(c *gin.Context) string

GetCSRFToken retrieves the CSRF token from the context

func RequireAdmin added in v0.2.0

func RequireAdmin(userService *services.UserService) gin.HandlerFunc

RequireAdmin is a middleware that requires the user to have admin role This middleware should be used after RequireAuth

func RequireAuth

func RequireAuth() gin.HandlerFunc

RequireAuth is a middleware that requires the user to be logged in

Types

This section is empty.

Jump to

Keyboard shortcuts

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