Documentation
¶
Index ¶
Constants ¶
View Source
const ( // jwt subject USER = "user" UserTokenTimeout = int64(60 * 60 * 24) // 1天 BufferTime = int64(60 * 60 * 2) UserLoginTokenTimeout = int64(60 * 5) // 5 min )
Variables ¶
Functions ¶
func InitUserJWT ¶
func InitUserJWT(key string)
Types ¶
type CustomClaims ¶
type CustomClaims struct {
UserID string `json:"userId"` // 用户ID
BufferTime int64 `json:"bufferTime"`
jwt.StandardClaims
}
func GenerateToken ¶
func GenerateToken(userID string, timeout int64) (*CustomClaims, string, error)
func ParseToken ¶
func ParseToken(token string) (*CustomClaims, error)
Click to show internal directories.
Click to hide internal directories.