auth

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 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 {
	// Parse token
	ParseToken(token string) (jwt.Claims, error)

	// Create token
	CreateToken(claimsCreator func() 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) CreateToken

func (jwtAuth JwtAuth) CreateToken(claimsCreator func() jwt.Claims) (string, error)

CreateToken create 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