middleware

package
v0.0.0-...-c676f21 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(redisIns *redis.Client, skipper ...SkipperFunc) gin.HandlerFunc

AuthMiddleware token授权验证

func CasbinMiddleware

func CasbinMiddleware(factory store.Factory, conf *config.Configuration, enforcer *casbin.Enforcer) gin.HandlerFunc

CasbinMiddleware 基于rbac

func Cors

func Cors(c *gin.Context)

Cors 参考地址 http://www.topgoer.com 插件库-跨域

func Exception

func Exception(glog *logger.GormZapLogger) gin.HandlerFunc

func GenIdempotenceToken

func GenIdempotenceToken(redisIns *redis.Client) string

func GetIdempotenceToken

func GetIdempotenceToken(redisIns *redis.Client) gin.HandlerFunc

GetIdempotenceToken 幂等性token获取接口

func GinLog

func GinLog(glog *logger.GormZapLogger) gin.HandlerFunc

GinLog zap替换gin的默认日志

func Idempotence

func Idempotence(redisIns *redis.Client, key string) gin.HandlerFunc

Idempotence 全局幂等性中间件

func InitGinJWTMiddleware

func InitGinJWTMiddleware(login func(c *gin.Context) (interface{}, error), jwtConf *config.JWTConfiguration) (*jwt.GinJWTMiddleware, error)

InitGinJWTMiddleware login为登录处理函数,因为gin-jwt是授权认证一体的,不需要授权功能传入nil即可

Types

type SkipperFunc

type SkipperFunc func(*gin.Context) bool

func AllowPathPreFixSkipper

func AllowPathPreFixSkipper(prefixs ...string) SkipperFunc

AllowPathPreFixSkipper 检查请求路径是否包含指定的前缀,如果包含则跳过

Jump to

Keyboard shortcuts

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