xichen01 commented on code in PR #4188:
URL: https://github.com/apache/ozone/pull/4188#discussion_r1554990590


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -736,17 +736,24 @@ private static void verifySpaceQuota(long quota) throws 
OMException {
    * @return listOfAcls
    * */
   private List<OzoneAcl> getAclList() {
+    UserGroupInformation realUserInfo = getRealUserInfo();
+    return OzoneAclUtil.getAclList(realUserInfo.getUserName(),
+        realUserInfo.getGroupNames(), userRights, groupRights);
+  }
+
+  /**
+   * Helper function to get the actual operating user.
+   *
+   * @return listOfAcls
+   * */
+  private UserGroupInformation getRealUserInfo() {
+    // After HDDS-5881 the user will not be different,
+    // as S3G uses single RpcClient. So we should be checking thread-local
+    // S3Auth and use it during proxy.
     if (ozoneManagerClient.getThreadLocalS3Auth() != null) {
-      UserGroupInformation aclUgi =
-          UserGroupInformation.createRemoteUser(
-             ozoneManagerClient.getThreadLocalS3Auth().getAccessID());
-      return OzoneAclUtil.getAclList(
-          aclUgi.getUserName(),
-          aclUgi.getGroupNames(),
-         userRights, groupRights);
+      return 
UserGroupInformation.createRemoteUser(getThreadLocalS3Auth().getUserPrincipal());
     }

Review Comment:
   updated, the result of the `UserGroupInformation.createRemoteUser()` will be 
cached for each `RPCClient`



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