jwt

package
v0.0.0-...-bcfd2cf Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config() middleware.JWTConfig

Config returns custom JWTConfig object

func NewToken

func NewToken(id, email string, d time.Duration) (string, error)

NewToken returns a new jwt token based on CustomClaims structure

func Validate

func Validate(t string) error

Validate receives a string token a verifies its validity

Types

type CustomClaims

type CustomClaims struct {
	ID    string `json:"id"`
	Email string `json:"email"`
	token.StandardClaims
}

CustomClaims custom token object

func Decode

func Decode(t interface{}) (*CustomClaims, error)

Decode takes the token string and returnes the CustomClaims instance

func (*CustomClaims) Valid

func (c *CustomClaims) Valid() error

Valid custom validation method for CustomClaims token object

Jump to

Keyboard shortcuts

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