auth

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 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 {
	GenerateToken(claims jwt.Claims) (string, error)
	ParseToken(token string) (jwt.Claims, error)
	ParseTokenWithClaims(token string, claims jwt.Claims) error
}

func NewJwt added in v1.0.0

func NewJwt(key []byte) Jwt

NewJwt return JwtAuth instance

type JwtAuth

type JwtAuth struct {
	// contains filtered or unexported fields
}

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

func (JwtAuth) ParseTokenWithClaims added in v0.9.13

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

ParseToken parse token

Jump to

Keyboard shortcuts

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