middleware

package
v0.0.0-...-b38ae35 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenExpired     = errors.New("Token is expired")
	TokenNotValidYet = errors.New("Token not active yet")
	TokenMalformed   = errors.New("That's not even a token")
	TokenInvalid     = errors.New("Couldn't handle this token:")
)

Functions

func CasbinHandler

func CasbinHandler() gin.HandlerFunc

拦截器

func Cors

func Cors() gin.HandlerFunc

处理跨域请求,支持options访问

func ErrorToEmail

func ErrorToEmail() gin.HandlerFunc

func GinRecovery

func GinRecovery(stack bool) gin.HandlerFunc

GinRecovery recover掉项目可能出现的panic,并使用zap记录相关日志

func JWTAuth

func JWTAuth() gin.HandlerFunc

func LoadTls

func LoadTls() gin.HandlerFunc

func NeedInit

func NeedInit() gin.HandlerFunc

处理跨域请求,支持options访问

func OperationRecord

func OperationRecord() gin.HandlerFunc

Types

type JWT

type JWT struct {
	SigningKey []byte
}

func NewJWT

func NewJWT() *JWT

func (*JWT) CreateToken

func (j *JWT) CreateToken(claims request.CustomClaims) (string, error)

创建一个token

func (*JWT) ParseToken

func (j *JWT) ParseToken(tokenString string) (*request.CustomClaims, error)

解析 token

Jump to

Keyboard shortcuts

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