token

package
v0.0.0-...-971e649 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTAccessGenerate

type JWTAccessGenerate struct {
	Client       *redis.Client
	SignedMethod jwt.SigningMethod
}

JWTAccessGenerate generate the jwt access token

func (*JWTAccessGenerate) Token

func (a *JWTAccessGenerate) Token(userid int64, role, username string, expired time.Duration) (string, error)

Token based on the UUID generated token

func (*JWTAccessGenerate) Verify

func (a *JWTAccessGenerate) Verify(ctx context.Context, token string) (*model.UserInfo, bool)

type TokenGenerate

type TokenGenerate interface {
	Token(userid int64, role, username string, expired time.Duration) (string, error)
	Verify(ctx context.Context, token string) (*model.UserInfo, bool)
}

func NewJWTAccessGenerate

func NewJWTAccessGenerate(cli *redis.Client, method jwt.SigningMethod) TokenGenerate

NewJWTAccessGenerate create to generate the jwt access token instance

Jump to

Keyboard shortcuts

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