You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/05/16 16:39:14 UTC

[incubator-doris] 04/17: [fix]Stream load 307 temporary redirection authentication information is lost (#9363)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch dev-1.0.1
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git

commit e0ed0067850500be8a8159265e0b797ce39d4db0
Author: jiafeng.zhang <zh...@gmail.com>
AuthorDate: Sat May 7 19:22:45 2022 +0800

    [fix]Stream load 307 temporary redirection authentication information is lost (#9363)
---
 .../apache/doris/httpv2/rest/RestBaseController.java   | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/RestBaseController.java b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/RestBaseController.java
index e2763caa93..5a8c7aa1b7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/RestBaseController.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/RestBaseController.java
@@ -75,11 +75,21 @@ public class RestBaseController extends BaseController {
         String userInfo = null;
         if (!Strings.isNullOrEmpty(request.getHeader("Authorization"))) {
             ActionAuthorizationInfo authInfo = getAuthorizationInfo(request);
-            // Fix username@cluster:passwod is modified to cluster: username:passwod causes authentication failure
-            // @see https://github.com/apache/incubator-doris/issues/8100
+            //username@cluster:password
+            //This is a Doris-specific parsing format in the parseAuthInfo of BaseController.
+            //This is to go directly to BE, but in fact,
+            //BE still needs to take this authentication information and send RPC
+            // to FE to parse the authentication information,
+            //so in the end, the format of this authentication information is parsed on the FE side.
+            //The normal format for fullUserName is actually default_cluster:username
+            //I don't know why the format username@default_cluster is used in parseAuthInfo.
+            //It is estimated that it is compatible with the standard format of username:password.
+            //So here we feel that we can assemble it completely by hand.
+            String clusterName = ConnectContext.get() == null ?
+                SystemInfoService.DEFAULT_CLUSTER : ConnectContext.get().getClusterName();
             userInfo = ClusterNamespace.getNameFromFullName(authInfo.fullUserName) +
-                    "@" + ClusterNamespace.getClusterNameFromFullName(authInfo.fullUserName) +
-                    ":" + authInfo.password;
+                "@" + clusterName  +
+                ":" + authInfo.password;
         }
         try {
             urlObj = new URI(urlStr);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org