正在显示
1 个修改的文件
包含
7 行增加
和
3 行删除
| @@ -159,8 +159,13 @@ func CheckToken(ctx *context.Context) (result bool) { | @@ -159,8 +159,13 @@ func CheckToken(ctx *context.Context) (result bool) { | ||
| 159 | var ( | 159 | var ( |
| 160 | msg *protocol.ResponseMessage | 160 | msg *protocol.ResponseMessage |
| 161 | ) | 161 | ) |
| 162 | - if strings.HasSuffix(ctx.Request.RequestURI, "login") { | ||
| 163 | - return true | 162 | + token := ctx.Input.Header("x-mmm-accesstoken") |
| 163 | + if token==""{ | ||
| 164 | + if strings.HasSuffix(ctx.Request.RequestURI, "login") || | ||
| 165 | + strings.HasSuffix(ctx.Request.RequestURI, "accessToken") || | ||
| 166 | + strings.HasSuffix(ctx.Request.RequestURI, "refreshToken") { | ||
| 167 | + return true | ||
| 168 | + } | ||
| 164 | } | 169 | } |
| 165 | result = true | 170 | result = true |
| 166 | defer func() { | 171 | defer func() { |
| @@ -169,7 +174,6 @@ func CheckToken(ctx *context.Context) (result bool) { | @@ -169,7 +174,6 @@ func CheckToken(ctx *context.Context) (result bool) { | ||
| 169 | ctx.Output.JSON(msg, false, false) | 174 | ctx.Output.JSON(msg, false, false) |
| 170 | } | 175 | } |
| 171 | }() | 176 | }() |
| 172 | - token := ctx.Input.Header("x-mmm-accesstoken") | ||
| 173 | if rsp, err := auth.CheckToken(&protocol.CheckTokenRequest{Token: token}); err != nil || rsp.UserInfo == nil { | 177 | if rsp, err := auth.CheckToken(&protocol.CheckTokenRequest{Token: token}); err != nil || rsp.UserInfo == nil { |
| 174 | msg = protocol.NewReturnResponse(rsp, err) | 178 | msg = protocol.NewReturnResponse(rsp, err) |
| 175 | log.Error(fmt.Sprintf("%v req:%v resp:%v", ctx.Request.RequestURI, token, common.AssertJson(msg))) | 179 | log.Error(fmt.Sprintf("%v req:%v resp:%v", ctx.Request.RequestURI, token, common.AssertJson(msg))) |
-
请 注册 或 登录 后发表评论