jwt

package
v0.1.0-nightly.1552475310 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ExpiredTime time.Duration = 1 * time.Hour

Variables

View Source
var (
	TokenExpired     error = errors.New("Token is expired")
	TokenNotValidYet error = errors.New("Token not active yet")
	TokenMalformed   error = errors.New("That's not even a token")
	TokenInvalid     error = errors.New("Couldn't handle this token:")
	TokenNoSet       error = errors.New("Token is not set")
)

Functions

This section is empty.

Types

type JWT

type JWT struct {
	SigningKey []byte
}

func NewJWT

func NewJWT(signKey string) *JWT

func (*JWT) CreateToken

func (j *JWT) CreateToken(id string, name string) (string, error)

func (*JWT) ParseToken

func (j *JWT) ParseToken(tokenString string) (*UserClaims, error)

func (*JWT) RefreshToken

func (j *JWT) RefreshToken(tokenString string) (string, error)

type UserClaims

type UserClaims struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	//Email string `json:"email"`
	jwt.StandardClaims
}

Jump to

Keyboard shortcuts

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