aws / aws-sdk-java-v2

The official AWS SDK for Java - Version 2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Presigned POST URL Generator with policy document

kimxogus opened this issue · comments

Supporting Presigned POST URL generators with policy documents

Expected Behavior

sdk is able to generate presigned post url with conditions.

Current Behavior

It's not supported yet.
V1 sdk also doesn't have this feature. aws/aws-sdk-java#834
It's not even in current plan as #203 (comment)

Context

To utilize presigned url's policy document.
In my case, our logic is

1. Client request to upload a file
2. Backend process pre condition checks like user authentications
3. Backend returns presigned post url and form fields for upload
	- Conditions are needed to limit bucket, object key, content type and content length range
	- As both V1 and V2 sdk doesn't support this feature, we call lambda function which written in js to generate presigned post url and use that.
4. Client uploads a file using the presigned post url and form fields

#203 (comment)

I've also recently faced this issue.
I would be willing to open a PR if someone were to point me in the right direction.

I have a use case where this feature would very useful. Is there any in progress on this issue?

I also need this feature and I would appreciate very much if someone allocated their time to implement this. Thank you!

Hi! Do you know anything new about this feature? :)

Hi you can follow this https://www.linkedin.com/pulse/s3-browser-based-uploads-using-http-post-md-mahadi-hossain/

On Thu, Dec 16, 2021 at 1:08 PM Łukasz Milunas @.***> wrote: Hi! Do you know anything new about this feature? :) — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#1493 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKSAVJM6UFMVJIMHE3HQXTURGGAHANCNFSM4JHCYBUA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Hello, do we have something similiar implemented on java or kotlin?
Also example said:

  • The ACL must be set to public-read. What if we want to set it private?
  • The object must be an image file. Why? If I want to upload different content types?
    or rather here we mean that what we have defined in the policy the same must be applied in request which is logical..

I use a bit of hacky code in Java.
You can find the gist here: https://gist.github.com/trinopoty/d617bbec19f249c723897ddf1cc1357d

Consider the snippet to be MIT licensed and modify it to suit your needs.

Also a gist to generate signed html form post requests in Java:
https://gist.github.com/trinopoty/f0272a4a33dcf455b3a7d4a70ed6b715

Hi you can follow this https://www.linkedin.com/pulse/s3-browser-based-uploads-using-http-post-md-mahadi-hossain/

On Thu, Dec 16, 2021 at 1:08 PM Łukasz Milunas @.***> wrote: Hi! Do you know anything new about this feature? :) — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#1493 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKSAVJM6UFMVJIMHE3HQXTURGGAHANCNFSM4JHCYBUA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Hello, do we have something similiar implemented on java or kotlin? Also example said:

  • The ACL must be set to public-read. What if we want to set it private?
  • The object must be an image file. Why? If I want to upload different content types?
    or rather here we mean that what we have defined in the policy the same must be applied in request which is logical..

That is- you are ordering to follow the instruction by that configuration. You can set {"acl": "public-read"}, ["starts-with", "$Content-Type", "image/"], according to your demand.

Follow this :

https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-post-example.html

Quick update: this feature is in our backlog, but we don't have a timeline for it yet.

Add a 👍 to the original description if you want to show your support, it helps us with prioritization.