middleware

package
v0.0.0-...-fff97c9 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenExpireDuration = time.Hour * 24 * 30

	NoJwtKey = "no_jwt"
)

Variables

This section is empty.

Functions

func GenToken

func GenToken(appId, openid string) (string, error)

GenToken 生成JWT

func GetRequestLog

func GetRequestLog(ctx *gin.Context, req, resp interface{}) string

func HandleRequest

func HandleRequest(handler func(ctx *beanctx.BizContext) (interface{}, *beanerr.BizError), req ...interface{}) func(ctx *gin.Context)

func JWTAuthMiddleware

func JWTAuthMiddleware() func(c *gin.Context)

JWTAuthMiddleware 基于JWT的认证中间件

func NoJWTAuth

func NoJWTAuth() func(c *gin.Context)

NoJWTAuth 免除JWT的认证

func ParseToken

func ParseToken(tokenString string) (*beanctx.JwtClaims, error)

ParseToken 解析JWT

func ValidJwt

func ValidJwt(ctx *gin.Context) error

Types

type HttpResponse

type HttpResponse struct {
	ErrCode int32       `json:"err_code"`
	Msg     string      `json:"msg"`
	Detail  string      `json:"detail"`
	Data    interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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