拦截请求处理
This commit is contained in:
parent
4e915d02ef
commit
9ef020f229
2
main.go
2
main.go
|
|
@ -178,7 +178,9 @@ func JWTAuthMiddleware() gin.HandlerFunc {
|
|||
|
||||
// 将用户信息添加到上下文中
|
||||
id := token.Claims.(jwt.MapClaims)["id"]
|
||||
username := token.Claims.(jwt.MapClaims)["username"]
|
||||
c.Set("id", id)
|
||||
c.Set("username", username)
|
||||
c.Set("user_id", int(id.(float64)))
|
||||
|
||||
if UserFuncIntercept(int(id.(float64)), c.Request.URL.Path) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue