midware

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cors added in v1.0.15

func Cors() gin.HandlerFunc

func GetJwtErrFromCtx added in v1.0.14

func GetJwtErrFromCtx(ctx *gin.Context, req JwtReq) error

从ctx取得JwtCtxErrKey

func GetJwtObj added in v1.0.12

func GetJwtObj() *jwtApi.JwtCfg

func GetMcFromCtx

func GetMcFromCtx(ctx *gin.Context, req JwtReq) (mc *jwtApi.MyClaims, err error)

GetMcFromCtx 从ctx取得 mc

func GetTokenObjFromCtx added in v1.0.8

func GetTokenObjFromCtx(ctx *gin.Context, req JwtReq, obj any) error

GetTokenObjFromCtx form ctx 取得 mc 并且将token JsonUnmarshal 到obj中,要求obj为对象地址

func InitJwtObj added in v1.0.12

func InitJwtObj(obj *jwtApi.JwtCfg)

func JWTAuthMiddleware

func JWTAuthMiddleware(req JwtReq) gin.HandlerFunc

JWTAuthMiddleware 基于JWT认证中间件

Types

type CtxKey added in v1.0.12

type CtxKey struct {
	JwtHeaderKey string
	JwtCtxErrKey string
	JwtCtxMcKey  string
}

type JwtReq added in v1.0.12

type JwtReq struct {
	JwtObj *jwtApi.JwtCfg
	JwtCtx CtxKey
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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