middleware

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessControl

func AccessControl(allowedUsers []string) gin.HandlerFunc

AccessControl 用户访问控制(重要:应该在 UserAuth 中间件后使用)

func CORS

func CORS(allowedOrigins []string) gin.HandlerFunc

CORS 用于管理跨域请求

func CSRF

func CSRF(appID string, secret string) gin.HandlerFunc

CSRF 中间件用于防止跨站请求伪造

func CSRFToken

func CSRFToken(appID string, domain string) gin.HandlerFunc

CSRFToken 中间件用于在 cookie 中设置 csrf token

func I18n

func I18n() gin.HandlerFunc

I18n 国际化中间件

func QueryTokenAuth

func QueryTokenAuth(token string) gin.HandlerFunc

QueryTokenAuth 中间件用过 query 参数中的 token 验证访问者身份,一般用于 healthz / metrics API

func RequestID

func RequestID() gin.HandlerFunc

RequestID 中间件用于注入 RequestID

func UserAuth

func UserAuth(authBackends []account.AuthBackend) gin.HandlerFunc

UserAuth 进行用户身份认证,并将用户信息注入到 context 中

Types

This section is empty.

Jump to

Keyboard shortcuts

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