Documentation
¶
Index ¶
- type Provider
- type Session
- func (s *Session) Claims() *jwt.Claims
- func (s *Session) Del(ctx context.Context, key string) error
- func (s *Session) Destroy(ctx context.Context) error
- func (s *Session) Get(ctx context.Context, key string) (any, error)
- func (s *Session) Refresh(ctx context.Context) error
- func (s *Session) Set(ctx context.Context, key string, val any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider Redis Session 提供者
func NewProvider ¶
func NewProvider(client redis.Cmdable, jwtKey string, accessExpire, refreshExpire time.Duration, tokenCarrier session.TokenCarrier) *Provider
NewProvider 创建 Redis Session 提供者 client: Redis 客户端 jwtKey: JWT 签名密钥 accessExpire: Access Token 过期时间(建议 15 分钟 - 2 小时) refreshExpire: Refresh Token 过期时间(建议 7 天 - 30 天) tokenCarrier: Token 载体(如何传输 Token)
Click to show internal directories.
Click to hide internal directories.