middlewares

package
v0.0.0-...-3ac9adb Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Secret []byte

Functions

func AuthUser

func AuthUser() gin.HandlerFunc

验证用户中间件, 若没有token会返回400, 验证失败会返回401, 找不到用户会返回404, 响应code为1, 2, 3

func InitSecret

func InitSecret()

func Parse

func Parse(ctx *gin.Context, tokenString string) (uint, error)

解析token, 仅传入token字符串, 仅判断是否转换成功与令牌是否超时

func Sign

func Sign(userID uint) (string, error)

签发token, 仅传入userID, token令牌中仅包含id和创建时间

Types

This section is empty.

Jump to

Keyboard shortcuts

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