go_jwt

package
v0.0.0-...-accfc52 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SignKey          = "xxxxx"
	TokenExpired     = errors.New("令牌已经过期")
	TokenNotValidYet = errors.New("不是有效的令牌")
	TokenMalformed   = errors.New("令牌发生异常")
	TokenInvalid     = errors.New("令牌无效")
)

Functions

func JwtSetSignKey

func JwtSetSignKey(key string)

Types

type CustomClaimsPayload

type CustomClaimsPayload struct {
	Host string
	jwt.StandardClaims
}

载荷,可以加一些自己需要的信息

type JwtObject

type JwtObject struct {
	SignKey []byte
}

func NewJwtObject

func NewJwtObject() *JwtObject

func (*JwtObject) CreateJwtToken

func (c *JwtObject) CreateJwtToken(claims CustomClaimsPayload) (string, error)

func (*JwtObject) JwtParse

func (c *JwtObject) JwtParse(tokenString string) (*CustomClaimsPayload, error)

func (*JwtObject) JwtRefreshToken

func (c *JwtObject) JwtRefreshToken(tokenString string) (string, error)

Jump to

Keyboard shortcuts

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