ChenSammi commented on code in PR #9654:
URL: https://github.com/apache/ozone/pull/9654#discussion_r2720602177
##########
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:
It's better we catch the exception from assumeRole() and
generateAssumeRoleResponse(), wrap it as OS3Exception to return.
--
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]