Documentation
¶
Index ¶
Constants ¶
View Source
const ( // SECRET SECRET SECRET string = "asdhjsdhhdhdhdhsasd" )
Variables ¶
View Source
var Auth gin.HandlerFunc = func(c *gin.Context) { log.Printf("auth middleware") token, err := getToken(c) if err != nil || token == "" { handleErr(c, "") return } user, err := parseToken(token) if err != nil { handleErr(c, "解析token错误") return } c.Set("user", user) }
Auth 用户认证中间件
Functions ¶
func CreateToken ¶
CreateToken 创建token
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.