1
votes

Currently my website runs on google app engine with Django and my static files are served using google cloud storage. I had explored the documentations and I could not find a easy way to serve my static files securely.

Let say i am logged in as a user into Django site. I only want the logged in user to see the picture and other user can't see the picture.

Currently the picture is serve using a link to the google cloud storage and the access are made public.

However, that means that anyone with that link can view that picture. How do i make sure that only the logged in person with the link can view the image instead of everyone with the link can view it, is there any way to do it with google app engine standard, google cloud storage and Django?

I also know that google cloud storage can have some form of access control but how do i link that part with Django users?

1

1 Answers

1
votes

Maybe you can set your bucket acl to private and implement Signed URL feature for your purpose.

https://cloud.google.com/storage/docs/access-control/signed-urls

For Python take a look at documentation about signed URLs: https://googleapis.github.io/google-cloud-python/latest/storage/blobs.html#google.cloud.storage.blob.Blob.generate_signed_url