certmanager updates
This commit is contained in:
@@ -15,8 +15,6 @@ func (hand *Handler) Authentificate(ctx context.Context) (int64, error) {
|
||||
var accountID int64
|
||||
|
||||
meta, _ := metadata.FromIncomingContext(ctx)
|
||||
hand.log.Debugf("Reqest username: %s", meta["username"])
|
||||
hand.log.Debugf("Reqest password: %s", meta["password"])
|
||||
usernameArr := meta["username"]
|
||||
passwordArr := meta["password"]
|
||||
if len(usernameArr) == 0 || len(passwordArr) == 0 {
|
||||
|
||||
@@ -80,7 +80,7 @@ func (svc *Service) Run() error {
|
||||
|
||||
gsrvOpts := []grpc.ServerOption{
|
||||
grpc.Creds(tlsCredentials),
|
||||
grpc.UnaryInterceptor(svc.debugInterceptor),
|
||||
grpc.UnaryInterceptor(svc.logInterceptor),
|
||||
}
|
||||
svc.gsrv = grpc.NewServer(gsrvOpts...)
|
||||
|
||||
@@ -94,22 +94,20 @@ func (svc *Service) Run() error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (svc *Service) debugInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) {
|
||||
svc.log.Debugf("Called unary interceptor with method: %v", info.FullMethod)
|
||||
func (svc *Service) logInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) {
|
||||
meta, _ := metadata.FromIncomingContext(ctx)
|
||||
svc.log.Debugf("Reqest username: %v", meta["username"])
|
||||
svc.log.Debugf("Reqest password: %v", meta["password"])
|
||||
svc.log.Infof("User %v called %v", meta["username"], info.FullMethod)
|
||||
return handler(ctx, req)
|
||||
}
|
||||
|
||||
func (svc *Service) logInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) {
|
||||
func (svc *Service) debugInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) {
|
||||
var err error
|
||||
svc.log.Debugf("Called unary interceptor with method: %v", info.FullMethod)
|
||||
|
||||
reqBinary, err := json.Marshal(req)
|
||||
requestString := ""
|
||||
if err == nil {
|
||||
svc.log.Debugf("Request: %f", string(reqBinary))
|
||||
requestString = string(reqBinary)
|
||||
}
|
||||
svc.log.Debugf("Called method: %v with params %v", info.FullMethod, requestString)
|
||||
return handler(ctx, req)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user