jwtx

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidToken     = errors.New("invalid auth token")
	ErrNoClaims         = errors.New("no auth params")
	ErrNotDetailField   = errors.New("no detail field")
	ErrJwtGenerateError = errors.New("token generate error")
)

Functions

This section is empty.

Types

type JWT

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

func NewJWT

func NewJWT() *JWT

func (*JWT) DelCacheToken

func (j *JWT) DelCacheToken(ctx context.Context, uid any) (err error)

DelCacheToken 删除缓存的token

func (*JWT) GenerateToken

func (j *JWT) GenerateToken(ctx context.Context, uid any, claims jwt.MapClaims) (string, error)

func (*JWT) GetCacheToken added in v0.0.2

func (j *JWT) GetCacheToken(ctx context.Context, uid any) (token string, err error)

GetCacheToken 获取缓存的token

func (*JWT) ParseToken

func (j *JWT) ParseToken(r *http.Request) (uid any, claims jwt.MapClaims, err error)

func (*JWT) WithRdb

func (j *JWT) WithRdb(rdb redis.UniversalClient) *JWT

func (*JWT) WithScene

func (j *JWT) WithScene(scene string) *JWT

func (*JWT) WithSecret

func (j *JWT) WithSecret(secret string) *JWT

func (*JWT) WithSso

func (j *JWT) WithSso(sso bool) *JWT

func (*JWT) WithTTL

func (j *JWT) WithTTL(ttl int64) *JWT

Jump to

Keyboard shortcuts

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