jwt

package
v0.0.0-...-d13da26 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AtKey = []byte("95osj3fUD7fo0mlYdDbncXz4VD2igvf0")
	RtKey = []byte("95osj3fUD7fo0mlYdDbncXz4VD2igvfx")
)

Functions

This section is empty.

Types

type Handler

type Handler interface {
	SetLoginToken(ctx *gin.Context, uid int64) error
	SetJWTToken(ctx *gin.Context, uid int64, ssid string) error
	ClearToken(ctx *gin.Context) error
	CheckSession(ctx *gin.Context, ssid string) error
	ExtractToken(ctx *gin.Context) string
}

func NewRedisJWTHandler

func NewRedisJWTHandler(cmd redis.Cmdable) Handler

type RedisJWTHandler

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

func (*RedisJWTHandler) CheckSession

func (h *RedisJWTHandler) CheckSession(ctx *gin.Context, ssid string) error

func (*RedisJWTHandler) ClearToken

func (h *RedisJWTHandler) ClearToken(ctx *gin.Context) error

func (*RedisJWTHandler) ExtractToken

func (h *RedisJWTHandler) ExtractToken(ctx *gin.Context) string

func (*RedisJWTHandler) SetJWTToken

func (h *RedisJWTHandler) SetJWTToken(ctx *gin.Context, uid int64, ssid string) error

func (*RedisJWTHandler) SetLoginToken

func (h *RedisJWTHandler) SetLoginToken(ctx *gin.Context, uid int64) error

type RefreshClaims

type RefreshClaims struct {
	Uid  int64
	Ssid string
	jwt.RegisteredClaims
}

type UserClaims

type UserClaims struct {
	jwt.RegisteredClaims
	// 声明你自己的要放进去 token 里面的数据
	Id   int64
	Ssid string
	// 自己随便加
	UserAgent string
}

Directories

Path Synopsis
Package jwtmocks is a generated GoMock package.
Package jwtmocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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