jwt

package
v0.0.0-...-183aa75 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Issuer                          = "Anonymous"
	SigningKey                      = []byte("please replace signingKey, use SetSigningKey function.")
	SigningMethod jwt.SigningMethod = jwt.SigningMethodHS256

	ErrCustomClaimsInValid = errors.New("custom claims invalid")
)

Functions

func GenerateJWTToken

func GenerateJWTToken(customClaims *CustomClaims) (string, error)

func GetCustomData

func GetCustomData(tokenStr string, data interface{}) error

func SetIssuer

func SetIssuer(issuer string)

func SetSigningKey

func SetSigningKey(key string)

func SetSigningMethod

func SetSigningMethod(method jwt.SigningMethod)

func VerifyJWTToken

func VerifyJWTToken(tokenStr string) (bool, error)

Types

type CustomClaims

type CustomClaims struct {
	CustomData interface{} `json:"custom_data"`
	jwt.StandardClaims
}

func NewCustomClaims

func NewCustomClaims(data interface{}, ttl time.Duration) *CustomClaims

type Token

type Token struct {
	jwt.Token
}

Jump to

Keyboard shortcuts

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