PakhomovAlexander commented on code in PR #2339:
URL: https://github.com/apache/ignite-3/pull/2339#discussion_r1273710611


##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/call/connect/ConnectCall.java:
##########
@@ -90,41 +100,41 @@ public CallOutput<String> execute(UrlCallInput input) {
         }
     }
 
-    private String fetchNodeName(String nodeUrl) throws ApiException {
-        return new 
NodeManagementApi(clientFactory.getClient(nodeUrl)).nodeState().getName();
-    }
-
-    /**
-     * Deduces whether the cluster has the authentication turned on and 
returns a name of successfully authenticated user or {@code null}.
-     *
-     * @param nodeUrl Node URL.
-     * @return Username if authentication was successful or {@code null} if 
not or if the cluster has no authentication turned on.
-     * @throws ApiException If fails to call an API.
-     */
     @Nullable
-    private String getAuthenticatedUsername(String nodeUrl) throws 
ApiException {
-        // Try without authentication first to check whether the 
authentication is enabled on the cluster.
-        String username = clientFactory.basicAuthenticationUsername();
-        if (!nullOrBlank(username)) {
-            try {
-                new 
NodeConfigurationApi(clientFactory.getClientWithoutBasicAuthentication(nodeUrl)).getNodeConfiguration();
-                return null;
-            } catch (ApiException e) {
-                if (e.getCause() == null) {
-                    Problem problem = 
IgniteCliApiExceptionHandler.extractProblem(e);
-                    if (problem.getStatus() == 
HttpStatus.UNAUTHORIZED.getCode()) {
-                        new 
NodeConfigurationApi(clientFactory.getClient(nodeUrl)).getNodeConfiguration();
-                        return username;
-                    }
+    private SessionInfo connectWithoutAuthentication(String nodeUrl) throws 
ApiException {
+        try {
+            ApiClient apiClient = 
clientFactory.getClientWithoutBasicAuthentication(nodeUrl);
+            return constructSessionInfo(apiClient, nodeUrl, null);
+        } catch (ApiException e) {
+            if (e.getCause() == null) {
+                Problem problem = 
IgniteCliApiExceptionHandler.extractProblem(e);
+                if (problem.getStatus() == HttpStatus.UNAUTHORIZED.getCode()) {

Review Comment:
   This is still not a fixed comment.



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

Reply via email to