有没有办法将字符串数组转换为 S3 策略,以便我可以将它传递给客户端以将文件直接上传到 S3。
我发现jets3t具有创建条件的库,但它没有任何功能仅用于构建策略。有没有一种方法可以以andcondition
的形式创建策略?string array
expiration date
private String generatePolicy(String assetKey, String contentType){
String[] conditions = {
S3Service.generatePostPolicyCondition_Equality("key", assetKey),
S3Service.generatePostPolicyCondition_Equality("Content-Type", contentType),
S3Service.generatePostPolicyCondition_Equality("acl", "public-read"),
//S3Service.generatePostPolicyCondition_Equality("success_action_redirect", value)
};
Date expiration = createDateNHoursFromNow(24);
// return S3Service.buildPolicy(expiration, condition); (which doesn't exit)
}