From fd7cec8224d3f62ab815363b1d91c448fe4f9c15 Mon Sep 17 00:00:00 2001 From: Robin <7434053+warrior_of_light_robin@user.noreply.gitee.com> Date: Tue, 26 Nov 2024 14:14:36 +0800 Subject: [PATCH] 1 --- app/mix/service/logic/token.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/mix/service/logic/token.go b/app/mix/service/logic/token.go index 407fdc1f..50665272 100644 --- a/app/mix/service/logic/token.go +++ b/app/mix/service/logic/token.go @@ -2,6 +2,7 @@ package logic import ( "fmt" + "service/api/base" tokenproto "service/api/proto/token/proto" "service/app/mix/dao" "service/dbstruct" @@ -168,5 +169,11 @@ func (p *Token) OpVerifyValid(ctx *gin.Context, token *jwt.Token) (int64, error) return -1, fmt.Errorf("登录失效,请重新登录!") } + // 校验是否本人 + req := ctx.MustGet("client_req").(base.BaseRequestAccessible) + if list[1].Mid != req.GetBaseRequest().Mid { + return -1, fmt.Errorf("非法令牌!") + } + return tokenUuid, nil }