Documentation ¶
Index ¶
- Variables
- type Handler
- type RedisHandler
- func (h *RedisHandler) CheckSession(ctx *gin.Context, ssid string) error
- func (h *RedisHandler) ClearToken(ctx *gin.Context) error
- func (h *RedisHandler) ExtractTokenString(ctx *gin.Context) string
- func (h *RedisHandler) SetJWTToken(ctx *gin.Context, ssid string, uid int64) error
- func (h *RedisHandler) SetLoginToken(ctx *gin.Context, uid int64) error
- type RefreshClaims
- type UserClaims
Constants ¶
This section is empty.
Variables ¶
View Source
var AccessTokenKey = []byte("moyn8y9abnd7q4zkq2m73yw8tu9j5ixm")
AccessTokenKey 因为 JWT Key 不太可能变,所以可以直接写成常量 也可以考虑做成依赖注入
View Source
var RefreshTokenKey = []byte("moyn8y9abnd7q4zkq2m73yw8tu9j5ixA")
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface { ClearToken(ctx *gin.Context) error SetLoginToken(ctx *gin.Context, uid int64) error SetJWTToken(ctx *gin.Context, ssid string, uid int64) error CheckSession(ctx *gin.Context, ssid string) error ExtractTokenString(ctx *gin.Context) string }
func NewRedisHandler ¶
func NewRedisHandler(cmd redis.Cmdable) Handler
type RedisHandler ¶
type RedisHandler struct {
// contains filtered or unexported fields
}
func (*RedisHandler) CheckSession ¶
func (h *RedisHandler) CheckSession(ctx *gin.Context, ssid string) error
func (*RedisHandler) ClearToken ¶
func (h *RedisHandler) ClearToken(ctx *gin.Context) error
ClearToken 清除 token
func (*RedisHandler) ExtractTokenString ¶
func (h *RedisHandler) ExtractTokenString(ctx *gin.Context) string
func (*RedisHandler) SetJWTToken ¶
func (*RedisHandler) SetLoginToken ¶
func (h *RedisHandler) SetLoginToken(ctx *gin.Context, uid int64) error
SetLoginToken 设置登录后的 token
type RefreshClaims ¶
Click to show internal directories.
Click to hide internal directories.