jwt

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateToken

func ValidateToken(tokenString string, secretKey string) (jwtgo.MapClaims, error)

验证客服端token可用性

Types

type Jwter

type Jwter struct {
	SecretKey   string
	TokenString string
	Expires     float64
	Claims      jwtgo.MapClaims
}

func NewJWTer

func NewJWTer(secretKey string, expires int) *Jwter

func (*Jwter) CreateJwt

func (j *Jwter) CreateJwt(data map[string]interface{}) (string, error)

data中的expires字段会被忽略,使用初始化时设置的Expires//

func (*Jwter) Delete

func (j *Jwter) Delete(key string) (string, error)

删除token属性和值

func (*Jwter) GetTokenClaims

func (j *Jwter) GetTokenClaims() (jwtgo.MapClaims, error)

获取claims里面的参数

func (*Jwter) Set

func (j *Jwter) Set(key string, value interface{}) (string, error)

设置token属性和值

Jump to

Keyboard shortcuts

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