middleware

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const JWTSessionConst = "__JWT_SESSION__"
View Source
const UID_KEY = "uid"

Variables

View Source
var (
	ErrorNoLogin = errors.New("请登录后操作")
)

Functions

func Auth

func Auth(r *ghttp.Request, secret string, guard string, storage IStorage)

Auth 授权中间件

func AuthHeaderToken

func AuthHeaderToken(r *ghttp.Request) string

Types

type IStorage

type IStorage interface {
	// IsBlackList 判断是否是黑名单
	IsBlackList(ctx context.Context, token string) bool
}

type JSession

type JSession struct {
	Uid       int    `json:"uid"`
	Token     string `json:"token"`
	ExpiresAt int64  `json:"expires_at"`
}

Jump to

Keyboard shortcuts

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