tokenutil

package
v0.0.0-...-4675295 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrParseFail   = errors.New("token parse fail")
	ErrIllegal     = errors.New("token invalid")
	ErrExpired     = errors.New("token expired")
	ErrUseNotmatch = errors.New("token use notmatch")
)

Functions

func CreateToken

func CreateToken(info *TokenInfo, hmacSampleSecret string) (t string, err error)

CreateLater 令牌-创建

Types

type TokenInfo

type TokenInfo struct {
	// 用户id
	Uid string
	// 权限
	Role string
	//
	Time int32
	//
	JwtToken *jwt.Token
}

TokenInfo 令牌信息

func ParseToken

func ParseToken(tok, secret string) (info *TokenInfo, err error)

func (*TokenInfo) GetLogObj

func (info *TokenInfo) GetLogObj() (r map[string]interface{})

func (*TokenInfo) Valid

func (info *TokenInfo) Valid(expiredTime int) (err error)

Valid 验证token

Jump to

Keyboard shortcuts

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