谷歌云存储 - 签名网址 - 一次性访问 [英] Google cloud storage - signed urls - one time access

查看:23
本文介绍了谷歌云存储 - 签名网址 - 一次性访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们计划使用带有签名 URL 的 Google 云存储,我们可以提供给用户.

we are planning to use Google cloud storage with signed urls that we can give to users.

所以我们上传一个文件生成签名 URL(使用此处提到的详细信息:https://developers.google.com/storage/docs/accesscontrol#Signed-URLs)

So we upload a document Generate the signed url (using the details mentioned here: https://developers.google.com/storage/docs/accesscontrol#Signed-URLs)

问题在于 google(或)aws 等.它们为 URL 提供了过期时间(例如:几分钟/几小时/几天等.)但我们希望 url 在一定数量的请求后过期

The issue is that google (or) aws etc.. they provide expiration time for the URLs (say : few min/ few hours/ few days etc..) But we want the urls to expire after certain number of requests

假设,我生成 URL 并发送给我的用户(大约 4 小时到期),我们希望该 url 在用户第二次访问该 URL 后过期(当用户第三次访问该 URL 时,它(google) 不应返回数据.

Let us say, I generate the URL and send to my user (with some 4 hrs expiration) and we want that url to expire after user access the URL for 2nd time (when the user access the URL for 3rd time, it (google) should not return the data.

这可能吗?

推荐答案

您可以通过允许服务帐户仅读取和创建对象来实现此目的.这样,该链接(一旦使用)就不能再次上传到同一个文件,因为它需要先删除它,而服务帐户没有权限.

You can achieve this by allowing the service account to read and create objects only. This way the link - once used - can't be used to upload again to the same file since it needs to delete it first which the service account doesn't have permission to.

这篇关于谷歌云存储 - 签名网址 - 一次性访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆