From 0be94908404fcfef7d2656c34587184167c23d26 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 17 Sep 2024 21:57:37 +0800 Subject: [PATCH] dev --- service/context.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/service/context.go b/service/context.go index 3d52993..7465cfa 100644 --- a/service/context.go +++ b/service/context.go @@ -2,9 +2,9 @@ package service import ( "context" + "encoding/json" "strings" - "git.apinb.com/bsm-sdk/engine/encipher" "git.apinb.com/bsm-sdk/engine/exception" "git.apinb.com/bsm-sdk/engine/types" "google.golang.org/grpc/metadata" @@ -23,14 +23,15 @@ func ParseMetaCtx(ctx context.Context, opts *ParseOptions) (*types.JwtClaims, er return nil, exception.ErrAuthNotFound } - var Authorizations []string = md.Get("authorization") + var Authorizations []string = md.Get("authorization_claims") if len(Authorizations) == 0 || Authorizations[0] == "" { return nil, exception.ErrAuthNotFound } - claims, err := encipher.ParseTokenAes(Authorizations[0]) + var claims types.JwtClaims + err := json.Unmarshal([]byte(Authorizations[0]), &claims) if err != nil { - return nil, err + return nil, exception.ErrAuthParseFail } if opts != nil { @@ -39,6 +40,6 @@ func ParseMetaCtx(ctx context.Context, opts *ParseOptions) (*types.JwtClaims, er } } - return claims, nil + return &claims, nil }