You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@amoro.apache.org by ji...@apache.org on 2024/06/13 02:12:21 UTC

(amoro) branch master updated: [AMORO-2918] Support multiple simple authrization username for different catalogs (#2919)

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

jinsongzhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git


The following commit(s) were added to refs/heads/master by this push:
     new 69b104344 [AMORO-2918] Support multiple simple authrization username for different catalogs (#2919)
69b104344 is described below

commit 69b104344828a6cc7466de24ed4c604075c7fa0e
Author: ZhouJinsong <zh...@163.com>
AuthorDate: Thu Jun 13 10:12:17 2024 +0800

    [AMORO-2918] Support multiple simple authrization username for different catalogs (#2919)
    
    Create different ugi for different hadoop usernae
---
 .../main/java/org/apache/amoro/table/TableMetaStore.java   | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/amoro-core/src/main/java/org/apache/amoro/table/TableMetaStore.java b/amoro-core/src/main/java/org/apache/amoro/table/TableMetaStore.java
index aa729be13..6815b81ea 100644
--- a/amoro-core/src/main/java/org/apache/amoro/table/TableMetaStore.java
+++ b/amoro-core/src/main/java/org/apache/amoro/table/TableMetaStore.java
@@ -344,19 +344,7 @@ public class TableMetaStore implements Serializable {
       if (ugi == null) {
         try {
           if (TableMetaStore.AUTH_METHOD_SIMPLE.equals(authMethod)) {
-            UserGroupInformation currentUser = UserGroupInformation.getCurrentUser();
-            if (currentUser == null
-                || !currentUser
-                    .getAuthenticationMethod()
-                    .equals(UserGroupInformation.AuthenticationMethod.valueOf(authMethod))
-                || !currentUser.getUserName().equals(hadoopUsername)) {
-              System.setProperty(HADOOP_USER_PROPERTY, hadoopUsername);
-              UserGroupInformation.setConfiguration(getConfiguration());
-              UserGroupInformation.loginUserFromSubject(null);
-              ugi = UserGroupInformation.getLoginUser();
-            } else {
-              ugi = currentUser;
-            }
+            ugi = UserGroupInformation.createRemoteUser(hadoopUsername);
           } else if (TableMetaStore.AUTH_METHOD_KERBEROS.equals(authMethod)) {
             constructKerberosUgi();
           }