You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/01/12 12:28:58 UTC

[GitHub] [skywalking] JaredTan95 commented on a change in pull request #4197: add token authentication between agent and oap receiver.

JaredTan95 commented on a change in pull request #4197: add token authentication between agent and oap receiver.
URL: https://github.com/apache/skywalking/pull/4197#discussion_r365579674
 
 

 ##########
 File path: oap-server/server-receiver-plugin/skywalking-sharing-server-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/sharing/server/ReceiverGRPCHandlerRegister.java
 ##########
 @@ -18,22 +18,39 @@
 
 package org.apache.skywalking.oap.server.receiver.sharing.server;
 
-import io.grpc.*;
+import io.grpc.BindableService;
+import io.grpc.ServerInterceptor;
+import io.grpc.ServerInterceptors;
+import io.grpc.ServerServiceDefinition;
+import java.util.Objects;
 import lombok.Setter;
 import org.apache.skywalking.oap.server.core.server.GRPCHandlerRegister;
 
 /**
- * @author peng-yongsheng
+ * @author peng-yongsheng, jian.tan
  */
 public class ReceiverGRPCHandlerRegister implements GRPCHandlerRegister {
 
     @Setter private GRPCHandlerRegister grpcHandlerRegister;
+    private ServerInterceptor interceptor;
 
     @Override public void addHandler(BindableService handler) {
-        grpcHandlerRegister.addHandler(handler);
+        if (Objects.isNull(interceptor)) {
+            grpcHandlerRegister.addHandler(handler);
+        } else {
+            grpcHandlerRegister.addHandler(handlerInterceptorBind(handler, interceptor));
+        }
 
 Review comment:
   Token authentication filter should only be activated in sharding server module. Moving to `GRPCServer` may not very suitable, in my thought.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services