From 152e18b0e57207fcc47f8df14356ff03a095df78 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Wed, 21 Jun 2023 12:29:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=AA=8C=E8=AF=81=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98,=20=E9=AA=8C=E8=AF=81allmo?= =?UTF-8?q?dels=E7=9A=84=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- goctl_template/api/context.tpl | 2 +- server/home-user-auth/internal/svc/servicecontext.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/goctl_template/api/context.tpl b/goctl_template/api/context.tpl index cbf433a3..cc14dc4f 100644 --- a/goctl_template/api/context.tpl +++ b/goctl_template/api/context.tpl @@ -43,7 +43,7 @@ func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, err return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) } // 返回用于验证签名的密钥 - return svcCtx.Config.Auth.AccessSecret, nil + return []byte(svcCtx.Config.Auth.AccessSecret), nil }) if err != nil { return nil, errors.New(fmt.Sprint("Error parsing token:", err)) diff --git a/server/home-user-auth/internal/svc/servicecontext.go b/server/home-user-auth/internal/svc/servicecontext.go index f96f50c8..d324dc9c 100644 --- a/server/home-user-auth/internal/svc/servicecontext.go +++ b/server/home-user-auth/internal/svc/servicecontext.go @@ -41,7 +41,7 @@ func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, err return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) } // 返回用于验证签名的密钥 - return svcCtx.Config.Auth.AccessSecret, nil + return []byte(svcCtx.Config.Auth.AccessSecret), nil }) if err != nil { return nil, errors.New(fmt.Sprint("Error parsing token:", err))