jwt

package
v1.21.2 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWT

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

func (*JWT) GenerateToken

func (t *JWT) GenerateToken(payload interface{}, expire time.Duration) (token string, expriets int64, err error)

GenerateToken Generate new jwt token

func (*JWT) ParseToken

func (t *JWT) ParseToken(token string) (*JWTClaims, error)

ParseToken Parse jwt token, return the claims

type JWTClaims

type JWTClaims struct {
	*jwt.StandardClaims
	Payload interface{}
}

type Options

type Options struct {
	Expire time.Duration `yaml:"expire" default:"24h0m0s" help:"jwt expire time"`
	Cert   string        `yaml:"cert" default:"certs/jwt/tls.crt" help:"jwt cert file"`
	Key    string        `yaml:"key" default:"certs/jwt/tls.key" help:"jwt key file"`
}

func DefaultOptions

func DefaultOptions() *Options

func (*Options) ToJWT

func (opts *Options) ToJWT() *JWT

Jump to

Keyboard shortcuts

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