From d7194a6e738aad392f2009845b5aa893825e6af4 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 16 Dec 2022 23:58:49 +0800 Subject: [PATCH] update auth --- pkg/interceptor/interceptor.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/pkg/interceptor/interceptor.go b/pkg/interceptor/interceptor.go index 1b592b5..93e5121 100644 --- a/pkg/interceptor/interceptor.go +++ b/pkg/interceptor/interceptor.go @@ -25,23 +25,16 @@ func NewInterceptor(name string, urlWhitelist map[string]int) grpc.UnaryServerIn logger.Logger.Debug(name, zap.Any("method", info.FullMethod), zap.Any("md", md), zap.Any("req", req), zap.Any("resp", resp), zap.Error(err)) + //resp, err = handleWithAuth(ctx, req, info, handler, urlWhitelist) + //logger.Logger.Debug(name, zap.Any("method", info.FullMethod), zap.Any("md", md), zap.Any("req", req), + // zap.Any("resp", resp), zap.Error(err)) + s, _ := status.FromError(err) if s.Code() != 0 && s.Code() < 1000 { md, _ := metadata.FromIncomingContext(ctx) logger.Logger.Error(name, zap.String("method", info.FullMethod), zap.Any("md", md), zap.Any("req", req), zap.Any("resp", resp), zap.Error(err), zap.String("stack", gerrors.GetErrorStack(s))) } - - resp, err = handleWithAuth(ctx, req, info, handler, urlWhitelist) - logger.Logger.Debug(name, zap.Any("method", info.FullMethod), zap.Any("md", md), zap.Any("req", req), - zap.Any("resp", resp), zap.Error(err)) - - ss, _ := status.FromError(err) - if ss.Code() != 0 && ss.Code() < 1000 { - md, _ := metadata.FromIncomingContext(ctx) - logger.Logger.Error(name, zap.String("method", info.FullMethod), zap.Any("md", md), zap.Any("req", req), - zap.Any("resp", resp), zap.Error(err), zap.String("stack", gerrors.GetErrorStack(ss))) - } return } }