imbajin commented on code in PR #265:
URL: 
https://github.com/apache/incubator-hugegraph-computer/pull/265#discussion_r1326733806


##########
computer-api/src/main/java/org/apache/hugegraph/computer/core/output/hg/task/TaskManager.java:
##########
@@ -56,7 +56,9 @@ public TaskManager(Config config) {
         this.config = config;
         String url = config.get(ComputerOptions.HUGEGRAPH_URL);
         String graph = config.get(ComputerOptions.HUGEGRAPH_GRAPH_NAME);
-        this.client = new HugeClientBuilder(url, graph).build();
+        String username = config.get(ComputerOptions.HUGEGRAPH_USERNAME);
+        String password = config.get(ComputerOptions.HUGEGRAPH_PASSWORD);
+        this.client = new HugeClientBuilder(url, graph).configUser(username, 
password).build();

Review Comment:
   Some refer:
   
   ```java
           String token = config.get(ComputerOptions.AUTH_TOKEN);
           String usrname = config.get(ComputerOptions.AUTH_USRNAME);
           String passwd = config.get(ComputerOptions.AUTH_PASSWD);
   
           // Use token first, then try passwd mode
           HugeClientBuilder clientBuilder = new HugeClientBuilder(url, graph);
           if (token != null && token.length() != 0) {
               this.client = clientBuilder.configToken(token).build();
           } else if (usrname != null && usrname.length() != 0) {
               this.client = clientBuilder.configUser(usrname, passwd).build();
           } else {
               this.client = clientBuilder.build();
           }
   ```



##########
computer-api/src/main/java/org/apache/hugegraph/computer/core/config/ComputerOptions.java:
##########
@@ -645,6 +645,22 @@ public static synchronized ComputerOptions instance() {
                     "hugegraph"
             );
 
+    public static final ConfigOption<String> HUGEGRAPH_USERNAME =
+            new ConfigOption<>(
+                    "hugegraph.username",
+                    "The graph username and password used for authentication.",
+                    null,
+                    ""
+            );
+
+    public static final ConfigOption<String> HUGEGRAPH_PASSWORD =
+            new ConfigOption<>(
+                    "hugegraph.password",
+                    "The graph username and password used for authentication.",
+                    null,
+                    ""
+            );
+

Review Comment:
   Some old refer:
   ```java
   
       public static final ConfigOption<String> AUTH_TOKEN =
               new ConfigOption<>(
                       "hugegraph.token",
                       "The auth value for compute job to certificate," +
                       " should only used for HugeGraph server now",
                       ""
               );
   
       public static final ConfigOption<String> AUTH_USRNAME =
               new ConfigOption<>(
                       "hugegraph.usrname",
                       "The usrname for compute job to certificate with " +
                       "basic auth, should only used in test environment, " +
                       "consider ban it in future.",
                       ""
               );
   
       public static final ConfigOption<String> AUTH_PASSWD =
               new ConfigOption<>(
                       "hugegraph.passwd",
                       "The password for compute job to certificate with " +
                       "basic auth, should only used in test environment, " +
                       "consider ban it in future.",
                       ""
               );
   ```



##########
computer-test/src/main/java/org/apache/hugegraph/computer/suite/unit/UnitTestBase.java:
##########
@@ -127,6 +129,11 @@ public static void init() throws ClassNotFoundException {
         GRAPH = ComputerOptions.HUGEGRAPH_GRAPH_NAME
                 .defaultValue();
 
+        USERNAME = ComputerOptions.HUGEGRAPH_USERNAME
+                .defaultValue();
+        PASSWORD = ComputerOptions.HUGEGRAPH_PASSWORD
+                .defaultValue();
+

Review Comment:
   could refer:
   
   <img width="757" alt="image" 
src="https://github.com/apache/incubator-hugegraph-computer/assets/17706099/8620ea0d-8d3f-4605-a64f-cfd5d747339c";>
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to