Documentation
¶
Index ¶
- Variables
- func GenerateToken(claims jwt.Claims, secret interface{}) (string, error)
- func ParseToken(claims jwt.Claims, token string, secret []byte) (*jwt.Token, error)
- func ParseTokenWithKeyFunc(claims jwt.Claims, token string, f jwt.Keyfunc) (*jwt.Token, error)
- func SetOptions(options ...jwt.ParserOption)
- type Claims
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Parser = jwt.NewParser() ErrInvalidToken = errors.New("invalid token") )
Functions ¶
func ParseToken ¶
func ParseTokenWithKeyFunc ¶
func SetOptions ¶
func SetOptions(options ...jwt.ParserOption)
Types ¶
type Claims ¶
type Claims[T any] struct { Auth T `json:"auth,omitempty"` jwt.RegisteredClaims }
如果只存一个id,jwt的意义在哪呢,跟session_id有什么区别 jwt应该存放一些用户不能更改的信息,所以不能全存在jwt里 或者说用户每更改一次信息就刷新token(貌似可行) 有泛型这里多好写
func (*Claims[T]) GenerateToken ¶
Click to show internal directories.
Click to hide internal directories.