package
Version:
v0.0.0-...-bd2a5d7
Opens a new window with list of versions in this module.
Published: Aug 30, 2023
License: MIT
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
GetUserIDAndUsername 获取用户ID和用户名
type MyClaims struct {
UserID int64 `json:"user_id"`
Username string `json:"username"`
jwt.StandardClaims
}
MyClaims 自定义声明结构体并内嵌jwt.StandardClaims
jwt包自带的jwt.StandardClaims只包含了官方字段
我们这里需要额外记录一个username字段,所以要自定义结构体
如果想要保存更多信息,都可以添加到这个结构体中
Source Files
¶
Click to show internal directories.
Click to hide internal directories.