jwt

package
v0.0.0-...-0eec0e3 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Customeclaims

type Customeclaims struct {
	jwt.StandardClaims
	UserName string
	Role     string
	Priority int
}

func New

func New(standard jwt.StandardClaims, uid string, role string, priority int) *Customeclaims

type JWTConf

type JWTConf struct {
	PrivateKey string `envconfig:"PRIVATE_KEY"`
	Duration   string `envconfig:"JWT_DURATION"`
}

type TokenGeneration

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

func NewTokenGeneration

func NewTokenGeneration() *TokenGeneration

func (*TokenGeneration) CheckExp

func (tkg *TokenGeneration) CheckExp(token string) bool

This method will check a token is expired with current time Return true if the token still no expired

func (TokenGeneration) CheckValib

func (tkg TokenGeneration) CheckValib(token string) bool

func (*TokenGeneration) CreateToken

func (tkg *TokenGeneration) CreateToken(uid string, role string, pri int) (string, error)

func (*TokenGeneration) GetPayload

func (tkg *TokenGeneration) GetPayload(token string) Customeclaims

Jump to

Keyboard shortcuts

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