jwt

package
v0.0.0-...-1a5fb70 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenExpired     = errors.New("token is expired")
	TokenNotValidYet = errors.New("token not active yet")
	TokenMalformed   = errors.New("that's malformed token")
	TokenInvalid     = errors.New("couldn't handle this token")
)

Functions

func JWTAuth

func JWTAuth() gin.HandlerFunc

Types

type CustomClaims

type CustomClaims struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Email     string `json:"email"`
	ProductId string `json:"product_id"`
	jwt.StandardClaims
}

type JWT

type JWT struct {
	SigningKey []byte
}

func (*JWT) CreateToken

func (j *JWT) CreateToken(claims CustomClaims) (string, error)

func (*JWT) ParseToken

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

func (*JWT) RefreshToken

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

Jump to

Keyboard shortcuts

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