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