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 }