jwt

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const OneDayTimestamp = 86400

Variables

View Source
var (
	TokenExpired     = errors.New("expired token")
	TokenNotValidYet = errors.New("unactivated token")
	TokenMalformed   = errors.New("unknown token")
	TokenInvalid     = errors.New("invalid token")
)

Functions

This section is empty.

Types

type CustomClaims

type CustomClaims struct {
	UID         string
	Username    string
	NickName    string
	AuthorityId string
	jwt.StandardClaims
}

type JWT

type JWT struct {
	SigningKey []byte
}

func NewJWT

func NewJWT(signKey string) *JWT

func (*JWT) CreateToken

func (j *JWT) CreateToken(claims CustomClaims) (string, error)

CreateToken 创建一个token

func (*JWT) ParseToken

func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error)

ParseToken 解析 token

Jump to

Keyboard shortcuts

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