ChenSammi commented on code in PR #11121:
URL: https://github.com/apache/ozone/pull/11121#discussion_r3923445283


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/s3/security/S3AssumeRoleRequest.java:
##########
@@ -174,12 +175,21 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager, Execut
             "S3AssumeRoleRequest does not have S3 authentication", 
OMException.ResultCodes.INVALID_REQUEST);
       }
 
-      // Generate session token using leader-generated credentials
-      final String sessionToken = generateSessionToken(
-          targetRoleName, omRequest, ozoneManager, assumeRoleRequest, 
secretAccessKey, tempAccessKeyId);
-
       // Generate AssumedRoleId for response using leader-generated roleId
       final String assumedRoleId = roleId + ":" + roleSessionName;
+      final String assumedRoleUserArn = 
S3STSUtils.toAssumedRoleUserArn(roleArn, roleSessionName);
+
+      // Generate session token using leader-generated credentials
+      final String sessionToken = 
generateSessionToken(GenerateSessionTokenParams.newBuilder()
+          .setTargetRoleName(targetRoleName)
+          .setOmRequest(omRequest)
+          .setOzoneManager(ozoneManager)
+          .setAssumeRoleRequest(assumeRoleRequest)
+          .setSecretAccessKey(secretAccessKey)
+          .setTempAccessKeyId(tempAccessKeyId)
+          .setAssumedRoleId(assumedRoleId)

Review Comment:
   If Ranger is able to return the role ID, then we can embed the role ID in 
the tokenSession, and Ranger verify the ID instead of role name during ACL 
check, this way even Ranger can change the role name, all the existing tokens 
will be still valid. 



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