jwt

package
v0.0.0-...-9e8b3cb Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenExpired     = errors.New("token is expired")
	TokenNotValidYet = errors.New("token not active yet")
	TokenMalformed   = errors.New("that's not even a token")
	TokenInvalid     = errors.New("couldn't handle this token")
)

一些常量

Functions

func GenerateToken

func GenerateToken(claims CustomClaims) (string, error)

func ReadSigningKey

func ReadSigningKey(privatePath, publicPath string)

读取密钥文件

func RefreshToken

func RefreshToken(tokenString string) (string, error)

Types

type CustomClaims

type CustomClaims struct {
	jwt.StandardClaims
	UserId int64 `json:"user_id"`
}

自定义载荷

func NewCustomClaims

func NewCustomClaims(userId int64) CustomClaims

创建claims

func ParseToken

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

Jump to

Keyboard shortcuts

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