You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by "EMsnap (via GitHub)" <gi...@apache.org> on 2024/04/11 02:16:49 UTC

[PR] [INLONG-9972][Sort] Pulsar connector support authentication when connecting to Pulsar cluster [inlong]

EMsnap opened a new pull request, #9973:
URL: https://github.com/apache/inlong/pull/9973

   - Fixes #9972
   
   ### Motivation
   
   According to https://pulsar.apache.org/docs/next/security-jwt/
   Some pulsar cluster have authentication opened in some cases, the sort connector should support authentication
   
   ### Modifications
   
   Added two parameter used in authentication
   1、pulsar client auth plugin class name, e.g. org.apache.pulsar.client.impl.auth.AuthenticationToken
   2、pulsar client auth params, the value should be compatible with the clientAuthPluginClassName, see also in 
   https://pulsar.apache.org/docs/next/security-jwt/
   
   ### Verifying this change
   
   Tested in pulsar cluster with authentication and the ExtractNode teste in PulsarSqlParserTest
   


-- 
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: commits-unsubscribe@inlong.apache.org

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


Re: [PR] [INLONG-9972][Sort] Pulsar connector support authentication when connecting to Pulsar cluster [inlong]

Posted by "aloyszhang (via GitHub)" <gi...@apache.org>.
aloyszhang commented on code in PR #9973:
URL: https://github.com/apache/inlong/pull/9973#discussion_r1560376943


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/extract/PulsarExtractNode.java:
##########
@@ -107,23 +129,27 @@ public PulsarExtractNode(@JsonProperty("id") String id,
     @Override
     public Map<String, String> tableOptions() {
         Map<String, String> options = super.tableOptions();
-        if (StringUtils.isEmpty(this.primaryKey)) {
+        if (StringUtils.isBlank(this.primaryKey)) {
             options.put("connector", "pulsar-inlong");
             options.putAll(format.generateOptions(false));
         } else {
             options.put("connector", "upsert-pulsar-inlong");
             options.putAll(format.generateOptions(true));
         }
-        if (adminUrl != null) {
+        if (StringUtils.isNotBlank(adminUrl)) {
             options.put("admin-url", adminUrl);
         }
         options.put("service-url", serviceUrl);
         options.put("topic", topic);
         options.put("scan.startup.mode", scanStartupMode);
-        if (scanStartupSubName != null) {
+        if (StringUtils.isNotBlank(scanStartupSubName)) {
             options.put("scan.startup.sub-name", scanStartupSubName);
             options.put("scan.startup.sub-start-offset", scanStartupSubStartOffset);
         }
+        if (StringUtils.isNotBlank(clientAuthPluginClassName)) {
+            options.put("pulsar.client.authPluginClassName", clientAuthPluginClassName);
+            options.put("pulsar.client.authParams", clientAuthParams);

Review Comment:
   does `clientAuthParams` also need a nullable check?



-- 
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: commits-unsubscribe@inlong.apache.org

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


Re: [PR] [INLONG-9972][Sort] Pulsar connector support authentication when connecting to Pulsar cluster [inlong]

Posted by "EMsnap (via GitHub)" <gi...@apache.org>.
EMsnap merged PR #9973:
URL: https://github.com/apache/inlong/pull/9973


-- 
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: commits-unsubscribe@inlong.apache.org

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


Re: [PR] [INLONG-9972][Sort] Pulsar connector support authentication when connecting to Pulsar cluster [inlong]

Posted by "EMsnap (via GitHub)" <gi...@apache.org>.
EMsnap commented on code in PR #9973:
URL: https://github.com/apache/inlong/pull/9973#discussion_r1560978457


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/extract/PulsarExtractNode.java:
##########
@@ -107,23 +129,27 @@ public PulsarExtractNode(@JsonProperty("id") String id,
     @Override
     public Map<String, String> tableOptions() {
         Map<String, String> options = super.tableOptions();
-        if (StringUtils.isEmpty(this.primaryKey)) {
+        if (StringUtils.isBlank(this.primaryKey)) {
             options.put("connector", "pulsar-inlong");
             options.putAll(format.generateOptions(false));
         } else {
             options.put("connector", "upsert-pulsar-inlong");
             options.putAll(format.generateOptions(true));
         }
-        if (adminUrl != null) {
+        if (StringUtils.isNotBlank(adminUrl)) {
             options.put("admin-url", adminUrl);
         }
         options.put("service-url", serviceUrl);
         options.put("topic", topic);
         options.put("scan.startup.mode", scanStartupMode);
-        if (scanStartupSubName != null) {
+        if (StringUtils.isNotBlank(scanStartupSubName)) {
             options.put("scan.startup.sub-name", scanStartupSubName);
             options.put("scan.startup.sub-start-offset", scanStartupSubStartOffset);
         }
+        if (StringUtils.isNotBlank(clientAuthPluginClassName)) {
+            options.put("pulsar.client.authPluginClassName", clientAuthPluginClassName);
+            options.put("pulsar.client.authParams", clientAuthParams);

Review Comment:
   fixed thx



-- 
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: commits-unsubscribe@inlong.apache.org

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