You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by "slowpao (via GitHub)" <gi...@apache.org> on 2023/03/02 06:10:23 UTC

[GitHub] [incubator-eventmesh] slowpao opened a new pull request, #3322: [ISSUE #3309] add subscriber acl authentication

slowpao opened a new pull request, #3322:
URL: https://github.com/apache/incubator-eventmesh/pull/3322

   ### Motivation
   
   add subscriber acl authentication , ensure that when the subscriber subscriber the message, the corresponding topic under a group can be queried in the etcd before the message can be subscribed
   
   
   
   ### Modifications
   1.query the correspondence between group and topic in etcd and compare whether the topic will to be subscribed is in etcd. If not, the topic cannot be subscribed. Mainly in the helloTask class and SubscribeTask class
   2. Add clientBuilder's token authentication in the PulsarConsumerImpl class
   
   
   
   ### Documentation
   
   - Does this pull request introduce a new feature? (yes / no)
   - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
   - If a feature is not applicable for documentation, explain why?
   - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
   


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] Markliniubility commented on a diff in pull request #3322: [ISSUE #3309] add subscriber acl authentication

Posted by "Markliniubility (via GitHub)" <gi...@apache.org>.
Markliniubility commented on code in PR #3322:
URL: https://github.com/apache/incubator-eventmesh/pull/3322#discussion_r1122731653


##########
eventmesh-registry-plugin/eventmesh-registry-etcd/src/main/java/org/apache/eventmesh/registry/etcd/service/EtcdCustomService.java:
##########
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.registry.etcd.service;
+
+import org.apache.eventmesh.api.exception.RegistryException;
+import org.apache.eventmesh.api.registry.bo.EventMeshAppSubTopicInfo;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.utils.JsonUtils;
+import org.apache.eventmesh.registry.etcd.constant.EtcdConstant;
+
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.etcd.jetcd.ByteSequence;
+import io.etcd.jetcd.Client;
+import io.etcd.jetcd.KeyValue;
+import io.etcd.jetcd.options.GetOption;
+
+public class EtcdCustomService extends EtcdRegistryService {
+
+    private static final String KEY_PREFIX = "eventMesh" + EtcdConstant.KEY_SEPARATOR;
+    private static final String KEY_APP = "app";
+    private static final String KEY_SERVICE = "service";
+    private static final Logger logger = LoggerFactory.getLogger(EtcdCustomService.class);
+
+
+    public EventMeshAppSubTopicInfo findEventMeshAppSubTopicInfoByGroup(String group) throws RegistryException {
+
+        Client client = getEtcdClient();
+        String keyPrefix = KEY_PREFIX + KEY_APP + EtcdConstant.KEY_SEPARATOR + group;
+        List<KeyValue> keyValues = null;
+        try {
+            ByteSequence keyByteSequence = ByteSequence.from(keyPrefix.getBytes(Constants.DEFAULT_CHARSET));
+
+            GetOption getOption = GetOption.newBuilder().withPrefix(keyByteSequence).build();
+
+            keyValues = client.getKVClient().get(keyByteSequence, getOption).get().getKvs();
+
+
+            if (CollectionUtils.isNotEmpty(keyValues)) {
+                for (KeyValue kv : keyValues) {
+                    EventMeshAppSubTopicInfo eventMeshAppSubTopicInfo =
+                        JsonUtils.parseObject(new String(kv.getValue().getBytes(), Constants.DEFAULT_CHARSET), EventMeshAppSubTopicInfo.class);
+                    return eventMeshAppSubTopicInfo;
+                }
+            }
+        } catch (Exception e) {
+            logger.error("[EtcdRegistryService][findEventMeshAppSubTopicInfoByGroup] error, group: {}", group, e);
+            throw new RegistryException(e.getMessage());
+        }
+
+        return null;

Review Comment:
   nit: When you have to return null or empty, maybe you can consider using `Optional` as a replacement or add a `@Nullable` annotation. 



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] slowpao commented on a diff in pull request #3322: [ISSUE #3309] add subscriber acl authentication

Posted by "slowpao (via GitHub)" <gi...@apache.org>.
slowpao commented on code in PR #3322:
URL: https://github.com/apache/incubator-eventmesh/pull/3322#discussion_r1123286356


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/SubscribeTask.java:
##########
@@ -59,10 +61,19 @@ public void run() {
             final List<SubscriptionItem> subscriptionItems = new ArrayList<>();
             final boolean eventMeshServerSecurityEnable = eventMeshTCPServer.getEventMeshTCPConfiguration().isEventMeshServerSecurityEnable();
             final String remoteAddr = RemotingHelper.parseChannelRemoteAddr(ctx.channel());
+
+            String group = session.getClient().getGroup();
+            String token = session.getClient().getToken();
+            String subsystem = session.getClient().getSubsystem();
+
+            EventMeshAppSubTopicInfo eventMeshAppSubTopicInfo = eventMeshTCPServer.getRegistry().findEventMeshAppSubTopicInfo(group);
             subscriptionInfo.getTopicList().forEach(item -> {
-                //do acl check for receive msg
                 if (eventMeshServerSecurityEnable) {

Review Comment:
   OK, I will fix it next time I submit



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] slowpao commented on a diff in pull request #3322: [ISSUE #3309] add subscriber acl authentication

Posted by "slowpao (via GitHub)" <gi...@apache.org>.
slowpao commented on code in PR #3322:
URL: https://github.com/apache/incubator-eventmesh/pull/3322#discussion_r1123281753


##########
eventmesh-registry-plugin/eventmesh-registry-etcd/src/main/java/org/apache/eventmesh/registry/etcd/service/EtcdRegistryService.java:
##########
@@ -231,6 +232,11 @@ public boolean unRegister(EventMeshUnRegisterInfo eventMeshUnRegisterInfo) throw
         }
     }
 
+    @Override
+    public EventMeshAppSubTopicInfo findEventMeshAppSubTopicInfoByGroup(String group) throws RegistryException {
+        return null;

Review Comment:
   It is implemented in the EtcdCustomService class



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] slowpao commented on a diff in pull request #3322: [ISSUE #3309] add subscriber acl authentication

Posted by "slowpao (via GitHub)" <gi...@apache.org>.
slowpao commented on code in PR #3322:
URL: https://github.com/apache/incubator-eventmesh/pull/3322#discussion_r1123280891


##########
eventmesh-connector-plugin/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/config/ClientConfiguration.java:
##########
@@ -25,7 +25,7 @@
 
 @Getter
 @Setter
-@Config(prefix = "eventMesh.server.pulsar", path = "classPath://pulsar-client.properties")
+@Config(prefix = "eventMesh.server.pulsar")

Review Comment:
   OK, I will fix it next time I submit



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] xwm1992 merged pull request #3322: [ISSUE #3309] add subscriber acl authentication

Posted by "xwm1992 (via GitHub)" <gi...@apache.org>.
xwm1992 merged PR #3322:
URL: https://github.com/apache/incubator-eventmesh/pull/3322


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] slowpao commented on a diff in pull request #3322: [ISSUE #3309] add subscriber acl authentication

Posted by "slowpao (via GitHub)" <gi...@apache.org>.
slowpao commented on code in PR #3322:
URL: https://github.com/apache/incubator-eventmesh/pull/3322#discussion_r1123289531


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/HelloTask.java:
##########
@@ -65,10 +65,17 @@ public void run() {
         Session session = null;
         UserAgent user = (UserAgent) pkg.getBody();
         try {
+
             //do acl check in connect
+            String remoteAddr = RemotingHelper.parseChannelRemoteAddr(ctx.channel());
+            String group = user.getGroup();
+            String token = user.getToken();
+            String subsystem = user.getSubsystem();
+            String topic = "ddd/dnamespace/dtopic";

Review Comment:
   OK, I will fix it next time I submit



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] xwm1992 commented on a diff in pull request #3322: [ISSUE #3309] add subscriber acl authentication

Posted by "xwm1992 (via GitHub)" <gi...@apache.org>.
xwm1992 commented on code in PR #3322:
URL: https://github.com/apache/incubator-eventmesh/pull/3322#discussion_r1122666820


##########
settings.gradle:
##########
@@ -66,4 +66,9 @@ include 'eventmesh-trace-plugin:eventmesh-trace-jaeger'
 include 'eventmesh-webhook'
 include 'eventmesh-webhook:eventmesh-webhook-api'
 include 'eventmesh-webhook:eventmesh-webhook-admin'
-include 'eventmesh-webhook:eventmesh-webhook-receive'
\ No newline at end of file
+include 'eventmesh-webhook:eventmesh-webhook-receive'
+include 'eventmesh-security-auth-token'
+include 'eventmesh-security-plugin:eventmesh-security-auth-token'
+findProject(':eventmesh-security-plugin:eventmesh-security-auth-token')?.name = 'eventmesh-security-auth-token'
+include 'eventmesh-security-plugin:eventmesh-security-acl-token'
+findProject(':eventmesh-security-plugin:eventmesh-security-acl-token')?.name = 'eventmesh-security-acl-token'

Review Comment:
   these lines can changed to :
   ```
   include 'eventmesh-security-plugin'
   include 'eventmesh-security-plugin:eventmesh-security-api'
   include 'eventmesh-security-plugin:eventmesh-security-auth-token'
   ```



##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java:
##########
@@ -72,6 +72,8 @@ public class CommonConfiguration {
     @ConfigFiled(field = "connector.plugin.type", notEmpty = true)
     private String eventMeshConnectorPluginType = "rocketmq";
 
+    @ConfigFiled(field = "security.validation.type.token", notEmpty = true)
+    private boolean eventMeshSecurityValidateTypeToken = false;

Review Comment:
   this configuration need add to the eventmesh.properties file, since it is marked with @ConfigFiled, you can refer to `eventMeshConnectorPluginType`



##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java:
##########
@@ -95,6 +97,8 @@ public class CommonConfiguration {
     @ConfigFiled(field = "server.registry.enabled")
     private boolean eventMeshServerRegistryEnable = false;
 
+    @ConfigFiled(field = "security.publickey")
+    private String eventMeshSecurityPublickey = "";

Review Comment:
   same as above



##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/acl/Acl.java:
##########
@@ -138,6 +141,15 @@ public void doAclCheckInHttpReceive(String remoteAddr, String user, String pass,
         aclService.doAclCheckInReceive(buildHttpAclProperties(remoteAddr, user, pass, subsystem, topic, requestURI));
     }
 
+    public void doAclCheckInTcpReceive(String remoteAddr, String token, String subsystem, String topic,
+        String requestURI, Object obj) throws AclException {
+        aclService.doAclCheckInReceive(buildHttpAclProperties(remoteAddr, token, subsystem, topic, requestURI, obj));

Review Comment:
   same as above



##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/SubscribeTask.java:
##########
@@ -59,10 +61,19 @@ public void run() {
             final List<SubscriptionItem> subscriptionItems = new ArrayList<>();
             final boolean eventMeshServerSecurityEnable = eventMeshTCPServer.getEventMeshTCPConfiguration().isEventMeshServerSecurityEnable();
             final String remoteAddr = RemotingHelper.parseChannelRemoteAddr(ctx.channel());
+
+            String group = session.getClient().getGroup();
+            String token = session.getClient().getToken();
+            String subsystem = session.getClient().getSubsystem();
+
+            EventMeshAppSubTopicInfo eventMeshAppSubTopicInfo = eventMeshTCPServer.getRegistry().findEventMeshAppSubTopicInfo(group);
             subscriptionInfo.getTopicList().forEach(item -> {
-                //do acl check for receive msg
                 if (eventMeshServerSecurityEnable) {

Review Comment:
   `findEventMeshAppSubTopicInfo` method move into `if(eventMeshServerSecurityEnable)` is more convenient.



##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/HelloTask.java:
##########
@@ -65,10 +65,17 @@ public void run() {
         Session session = null;
         UserAgent user = (UserAgent) pkg.getBody();
         try {
+
             //do acl check in connect
+            String remoteAddr = RemotingHelper.parseChannelRemoteAddr(ctx.channel());
+            String group = user.getGroup();
+            String token = user.getToken();
+            String subsystem = user.getSubsystem();
+            String topic = "ddd/dnamespace/dtopic";

Review Comment:
   What is the topic here for?



##########
eventmesh-registry-plugin/eventmesh-registry-etcd/src/main/java/org/apache/eventmesh/registry/etcd/service/EtcdRegistryService.java:
##########
@@ -231,6 +232,11 @@ public boolean unRegister(EventMeshUnRegisterInfo eventMeshUnRegisterInfo) throw
         }
     }
 
+    @Override
+    public EventMeshAppSubTopicInfo findEventMeshAppSubTopicInfoByGroup(String group) throws RegistryException {
+        return null;

Review Comment:
   the return value here is null, will it be implemented in other pr



##########
eventmesh-connector-plugin/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/config/ClientConfiguration.java:
##########
@@ -25,7 +25,7 @@
 
 @Getter
 @Setter
-@Config(prefix = "eventMesh.server.pulsar", path = "classPath://pulsar-client.properties")
+@Config(prefix = "eventMesh.server.pulsar")

Review Comment:
   why you remove this config: path = "classPath://pulsar-client.properties"



##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/acl/Acl.java:
##########
@@ -92,6 +94,11 @@ public void doAclCheckInTcpConnect(String remoteAddr, UserAgent userAgent, int r
         aclService.doAclCheckInConnect(buildTcpAclProperties(remoteAddr, userAgent, null, requestCode));
     }
 
+    public void doAclCheckInTcpConnect(String remoteAddr, String token, String subsystem, String topic,
+        String requestURI, Object obj) throws AclException {
+        aclService.doAclCheckInReceive(buildHttpAclProperties(remoteAddr, token, subsystem, topic, requestURI, obj));

Review Comment:
   this method will be triggered in tcp mode, but your's method is `buildHttpAclProperties`, it's not a good place to put it here



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] codecov[bot] commented on pull request #3322: [ISSUE #3309] add subscriber acl authentication

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #3322:
URL: https://github.com/apache/incubator-eventmesh/pull/3322#issuecomment-1451935852

   # [Codecov](https://codecov.io/gh/apache/incubator-eventmesh/pull/3322?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#3322](https://codecov.io/gh/apache/incubator-eventmesh/pull/3322?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (190a7de) into [master](https://codecov.io/gh/apache/incubator-eventmesh/commit/6636e3af2ef130a47ecd3276e14aa34f0232b583?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6636e3a) will **decrease** coverage by `0.04%`.
   > The diff coverage is `12.76%`.
   
   > :exclamation: Current head 190a7de differs from pull request most recent head c5e8479. Consider uploading reports for the commit c5e8479 to get more accurate results
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3322      +/-   ##
   ============================================
   - Coverage     13.09%   13.05%   -0.04%     
     Complexity     1159     1159              
   ============================================
     Files           550      551       +1     
     Lines         28718    28781      +63     
     Branches       2854     2850       -4     
   ============================================
   - Hits           3761     3758       -3     
   - Misses        24632    24700      +68     
   + Partials        325      323       -2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-eventmesh/pull/3322?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...in/java/org/apache/eventmesh/common/Constants.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3322?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9Db25zdGFudHMuamF2YQ==) | `85.71% <ø> (ø)` | |
   | [...esh/common/protocol/grpc/protos/EventmeshGrpc.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3322?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9wcm90b2NvbC9ncnBjL3Byb3Rvcy9FdmVudG1lc2hHcnBjLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...pache/eventmesh/common/protocol/tcp/UserAgent.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3322?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9wcm90b2NvbC90Y3AvVXNlckFnZW50LmphdmE=) | `2.40% <0.00%> (-0.16%)` | :arrow_down: |
   | [...entmesh/connector/kafka/consumer/ConsumerImpl.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3322?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbm5lY3Rvci1wbHVnaW4vZXZlbnRtZXNoLWNvbm5lY3Rvci1rYWZrYS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2Nvbm5lY3Rvci9rYWZrYS9jb25zdW1lci9Db25zdW1lckltcGwuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [.../connector/kafka/consumer/KafkaConsumerRunner.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3322?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbm5lY3Rvci1wbHVnaW4vZXZlbnRtZXNoLWNvbm5lY3Rvci1rYWZrYS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2Nvbm5lY3Rvci9rYWZrYS9jb25zdW1lci9LYWZrYUNvbnN1bWVyUnVubmVyLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...h/connector/pulsar/config/ClientConfiguration.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3322?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbm5lY3Rvci1wbHVnaW4vZXZlbnRtZXNoLWNvbm5lY3Rvci1wdWxzYXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9jb25uZWN0b3IvcHVsc2FyL2NvbmZpZy9DbGllbnRDb25maWd1cmF0aW9uLmphdmE=) | `66.66% <0.00%> (-13.34%)` | :arrow_down: |
   | [.../connector/pulsar/consumer/PulsarConsumerImpl.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3322?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbm5lY3Rvci1wbHVnaW4vZXZlbnRtZXNoLWNvbm5lY3Rvci1wdWxzYXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9jb25uZWN0b3IvcHVsc2FyL2NvbnN1bWVyL1B1bHNhckNvbnN1bWVySW1wbC5qYXZh) | `6.06% <0.00%> (-0.40%)` | :arrow_down: |
   | [...registry/consul/service/ConsulRegistryService.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3322?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJlZ2lzdHJ5LXBsdWdpbi9ldmVudG1lc2gtcmVnaXN0cnktY29uc3VsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9ldmVudG1lc2gvcmVnaXN0cnkvY29uc3VsL3NlcnZpY2UvQ29uc3VsUmVnaXN0cnlTZXJ2aWNlLmphdmE=) | `44.44% <0.00%> (-0.72%)` | :arrow_down: |
   | [...tmesh/registry/etcd/service/EtcdCustomService.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3322?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJlZ2lzdHJ5LXBsdWdpbi9ldmVudG1lc2gtcmVnaXN0cnktZXRjZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL3JlZ2lzdHJ5L2V0Y2Qvc2VydmljZS9FdGNkQ3VzdG9tU2VydmljZS5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...esh/registry/etcd/service/EtcdRegistryService.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3322?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJlZ2lzdHJ5LXBsdWdpbi9ldmVudG1lc2gtcmVnaXN0cnktZXRjZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL3JlZ2lzdHJ5L2V0Y2Qvc2VydmljZS9FdGNkUmVnaXN0cnlTZXJ2aWNlLmphdmE=) | `21.60% <0.00%> (-0.18%)` | :arrow_down: |
   | ... and [15 more](https://codecov.io/gh/apache/incubator-eventmesh/pull/3322?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] slowpao commented on a diff in pull request #3322: [ISSUE #3309] add subscriber acl authentication

Posted by "slowpao (via GitHub)" <gi...@apache.org>.
slowpao commented on code in PR #3322:
URL: https://github.com/apache/incubator-eventmesh/pull/3322#discussion_r1123289060


##########
eventmesh-registry-plugin/eventmesh-registry-etcd/src/main/java/org/apache/eventmesh/registry/etcd/service/EtcdCustomService.java:
##########
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.registry.etcd.service;
+
+import org.apache.eventmesh.api.exception.RegistryException;
+import org.apache.eventmesh.api.registry.bo.EventMeshAppSubTopicInfo;
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.utils.JsonUtils;
+import org.apache.eventmesh.registry.etcd.constant.EtcdConstant;
+
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.etcd.jetcd.ByteSequence;
+import io.etcd.jetcd.Client;
+import io.etcd.jetcd.KeyValue;
+import io.etcd.jetcd.options.GetOption;
+
+public class EtcdCustomService extends EtcdRegistryService {
+
+    private static final String KEY_PREFIX = "eventMesh" + EtcdConstant.KEY_SEPARATOR;
+    private static final String KEY_APP = "app";
+    private static final String KEY_SERVICE = "service";
+    private static final Logger logger = LoggerFactory.getLogger(EtcdCustomService.class);
+
+
+    public EventMeshAppSubTopicInfo findEventMeshAppSubTopicInfoByGroup(String group) throws RegistryException {
+
+        Client client = getEtcdClient();
+        String keyPrefix = KEY_PREFIX + KEY_APP + EtcdConstant.KEY_SEPARATOR + group;
+        List<KeyValue> keyValues = null;
+        try {
+            ByteSequence keyByteSequence = ByteSequence.from(keyPrefix.getBytes(Constants.DEFAULT_CHARSET));
+
+            GetOption getOption = GetOption.newBuilder().withPrefix(keyByteSequence).build();
+
+            keyValues = client.getKVClient().get(keyByteSequence, getOption).get().getKvs();
+
+
+            if (CollectionUtils.isNotEmpty(keyValues)) {
+                for (KeyValue kv : keyValues) {
+                    EventMeshAppSubTopicInfo eventMeshAppSubTopicInfo =
+                        JsonUtils.parseObject(new String(kv.getValue().getBytes(), Constants.DEFAULT_CHARSET), EventMeshAppSubTopicInfo.class);
+                    return eventMeshAppSubTopicInfo;
+                }
+            }
+        } catch (Exception e) {
+            logger.error("[EtcdRegistryService][findEventMeshAppSubTopicInfoByGroup] error, group: {}", group, e);
+            throw new RegistryException(e.getMessage());
+        }
+
+        return null;

Review Comment:
   OK, I will fix it next time I submit



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] slowpao commented on a diff in pull request #3322: [ISSUE #3309] add subscriber acl authentication

Posted by "slowpao (via GitHub)" <gi...@apache.org>.
slowpao commented on code in PR #3322:
URL: https://github.com/apache/incubator-eventmesh/pull/3322#discussion_r1123280426


##########
settings.gradle:
##########
@@ -66,4 +66,9 @@ include 'eventmesh-trace-plugin:eventmesh-trace-jaeger'
 include 'eventmesh-webhook'
 include 'eventmesh-webhook:eventmesh-webhook-api'
 include 'eventmesh-webhook:eventmesh-webhook-admin'
-include 'eventmesh-webhook:eventmesh-webhook-receive'
\ No newline at end of file
+include 'eventmesh-webhook:eventmesh-webhook-receive'
+include 'eventmesh-security-auth-token'
+include 'eventmesh-security-plugin:eventmesh-security-auth-token'
+findProject(':eventmesh-security-plugin:eventmesh-security-auth-token')?.name = 'eventmesh-security-auth-token'
+include 'eventmesh-security-plugin:eventmesh-security-acl-token'
+findProject(':eventmesh-security-plugin:eventmesh-security-acl-token')?.name = 'eventmesh-security-acl-token'

Review Comment:
   OK, I will fix it next time I submit



##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java:
##########
@@ -72,6 +72,8 @@ public class CommonConfiguration {
     @ConfigFiled(field = "connector.plugin.type", notEmpty = true)
     private String eventMeshConnectorPluginType = "rocketmq";
 
+    @ConfigFiled(field = "security.validation.type.token", notEmpty = true)
+    private boolean eventMeshSecurityValidateTypeToken = false;

Review Comment:
   OK, I will fix it next time I submit



##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java:
##########
@@ -95,6 +97,8 @@ public class CommonConfiguration {
     @ConfigFiled(field = "server.registry.enabled")
     private boolean eventMeshServerRegistryEnable = false;
 
+    @ConfigFiled(field = "security.publickey")
+    private String eventMeshSecurityPublickey = "";

Review Comment:
   OK, I will fix it next time I submit



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org