Is there a way to convert String array to S3 policy so i can pass it the client to upload file directly to S3.
I found jets3t which has library to create condition, but it doesn't have any function for just to build policy. Is there a way i can create policy from condition
in the form of string array
and 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)
}