basic

package
v0.0.0-...-997d260 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 4 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

This section is empty.

Types

type JwtService

type JwtService struct {
	SigningKey []byte
}

func NewJWT

func NewJWT() *JwtService

func (*JwtService) CreateToken

func (jwtService *JwtService) CreateToken(claims *auth.Claims) (string, error)

CreateToken 创建一个token

func (*JwtService) CreateTokenByOldToken

func (jwtService *JwtService) CreateTokenByOldToken(oldToken string, claims *auth.Claims) (string, error)

CreateTokenByOldToken 旧token 换新token 使用归并回源避免并发问题

func (*JwtService) ParseToken

func (jwtService *JwtService) ParseToken(tokenString string) (*auth.Claims, error)

ParseToken 解析 token

Jump to

Keyboard shortcuts

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