fmorg-git commented on code in PR #9654:
URL: https://github.com/apache/ozone/pull/9654#discussion_r2730093791


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3sts/S3STSEndpoint.java:
##########
@@ -203,11 +211,27 @@ private Response handleAssumeRole(String roleArn, String 
roleSessionName, int du
           .build();
     }
 
-    // TODO: Integrate with Ozone Manager to get actual temporary credentials
-    // String dummyCredentials = 
getClient().getObjectStore().getS3StsToken(userNameFromRequest());
-    // Generate AssumeRole response
-    String responseXml = generateAssumeRoleResponse(roleArn, roleSessionName, 
duration);
+    // Check Policy size if available
+    if (awsIamSessionPolicy != null && awsIamSessionPolicy.length() > 
MAX_SESSION_POLICY_SIZE) {
+      return Response.status(Response.Status.BAD_REQUEST)
+          .entity("Policy length exceeded maximum allowed length of " + 
MAX_SESSION_POLICY_SIZE)
+          .build();
+    }
+
+    final String assumedRoleUserArn;
+    try {
+      assumedRoleUserArn = toAssumedRoleUserArn(roleArn, roleSessionName);
+    } catch (IllegalArgumentException e) {
+      return Response.status(Response.Status.BAD_REQUEST)
+          .entity(e.getMessage())
+          .build();
+    }
 
+    final AssumeRoleResponseInfo responseInfo = getClient()

Review Comment:
   updated - per internal communication, I identified that the endpoint was 
returning plain text instead of XML, so I revamped the error handling to use a 
new `OSTSException` that conforms to AWS structure.  It distinguishes between 
signature mismatch and access denied similar to AWS 
https://github.com/apache/ozone/pull/9654/commits/bdb33a43f5f0fe0bb6a2ae1f8d7790cf439c79e8



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