Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims struct {
UserID uint `json:"user_id"`
Username string `json:"username"`
jwt.RegisteredClaims
}
Claims JWT声明
type JWTManager ¶
type JWTManager struct {
// contains filtered or unexported fields
}
JWTManager JWT管理器
func (*JWTManager) GenerateToken ¶
func (j *JWTManager) GenerateToken(userID uint, username string) (string, error)
GenerateToken 生成JWT token
func (*JWTManager) ValidateToken ¶
func (j *JWTManager) ValidateToken(tokenString string) (*Claims, error)
ValidateToken 验证JWT token
Click to show internal directories.
Click to hide internal directories.