问题
I would like to retrieve an image URL with non-public access using the AWS Android SDK. I will be displaying the image via the URL myself, but I'm not sure how to go about getting permissions via the secret access key.
I would like to keep these images private, so making them public is not an option for me.
How would I go about doing this?
回答1:
There is no way to create a URL to an image with access control built into the URL per se. Because if the URL alone is what has the access built into it (i.e. it has the signature already embedded), then who has the URL is not relevant.
Assuming you are using Amazon Cognito (which you probably should be) to vend temporary credentials to you application. You can then use IAM roles to restrict access to this image to just yourself. From there you could get the image yourself, or using the temporary credentials, create a pre-signed URL. However anyone with that URL will have access to the image for the duration up to its expiration.
来源:https://stackoverflow.com/questions/30941673/retrieving-image-url-with-specific-access-privileges-using-aws-mobile-sdk-for-an