auth

package
v0.9.10 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenValidateFailed = errors.New("token validate failed")
)

Functions

This section is empty.

Types

type Jwt

type Jwt interface {
	// 解析token
	ParseToken(token string) (jwt.Claims, error)

	// 生成token
	GenerateToken(claims jwt.Claims) (string, error)
}

Jwt json web token

func New

func New(signKey []byte) Jwt

New return JwtAuth instance

type JwtAuth

type JwtAuth struct {
	SignKey []byte
}

JwtAuth jwt

func (JwtAuth) GenerateToken added in v0.8.0

func (jwtAuth JwtAuth) GenerateToken(claims jwt.Claims) (string, error)

CreateToken 生成token

func (JwtAuth) ParseToken

func (jwtAuth JwtAuth) ParseToken(token string) (jwt.Claims, error)

ParseToken parse token

Jump to

Keyboard shortcuts

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