jwt

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	SecretKey  string `yaml:"secret_key"`
	ExpireTime int64  `yaml:"expire_time"`
	Issuer     string `yaml:"issuer"`
}

func FromEnv

func FromEnv() Conf

type ContextKey

type ContextKey struct {
	Name string
}

func NewContextKey

func NewContextKey(name string) ContextKey

func (ContextKey) Get

func (c ContextKey) Get(ctx context.Context) *CustomClaims

func (ContextKey) MustGet

func (c ContextKey) MustGet(ctx context.Context) *CustomClaims

type CustomClaims

type CustomClaims struct {
	jwt.RegisteredClaims
}

type JWT

type JWT struct {
	Conf Conf
}

func NewJWT

func NewJWT(conf Conf) JWT

func (*JWT) CreateToken

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

func (*JWT) ParserToken

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

Jump to

Keyboard shortcuts

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