middlewares

package
v0.0.0-...-b97b37b Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenKey  = "X-Token"
	ClaimsKey = "claims"
)
View Source
const GlobalContextKey = "global-contexts"

GlobalContextKey is the key in gin.Context for GlobalContext.

Variables

This section is empty.

Functions

func Cors

func Cors() gin.HandlerFunc

跨域

func GetClaims

func GetClaims(ctx *gin.Context) (*utils.CustomClaims, error)

获取用户信息

func GetGlobalContext

func GetGlobalContext(ctx *gin.Context) (*contexts.GlobalContext, error)

GetGlobalContext fetches the GlobalContext instance from middlewares.

func GinRecovery

func GinRecovery(stack bool) gin.HandlerFunc

func JWTAuth

func JWTAuth() gin.HandlerFunc

JWTAuth 中间件,检查token

func NeedRoleDBA

func NeedRoleDBA() gin.HandlerFunc

判断是否是DBA

func WithGlobalContext

func WithGlobalContext(globalCtx *contexts.GlobalContext) gin.HandlerFunc

WithGlobalContext injects the GlobalContext instance into gin.Context.

func ZapLogger

func ZapLogger() gin.HandlerFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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