我使用 ImagesService.getServingUrl(ServingUrlOptions options) 提供来自 blob 存储的图像: https://cloud.google.com/appengine/docs/java/javadoc/com/google/appengine/api/images/ImagesService#getServingUrl-com.google.appengine.api.images.ServingUrlOptions-
有没有办法对这些 URL 进行签名来控制对它们的访问? (与 Google 存储中的相同: https://cloud.google.com/storage/docs/access-control?hl=en#Signed-URLs )
有没有办法让这些 URL 成为临时的?
我将从 Blob 存储中动态创建这些 URL,以供有权查看它们的用户使用。
谢谢!
最佳答案
当您想要撤销访问权限时,可以使用相应的deleteServingURL。来自 docs :
If you wish to stop serving the URL, delete it using the deleteServingUrl() method.
另外:
Whether you store your images in Blobstore or Google Cloud Storage, the right way to stop an image from being publicly accessible through the serving URL is to call the deleteServingUrl() method.
这确实需要额外的记录来确定何时删除 URL 以及执行删除的定期任务,因此并不理想。但这似乎是唯一的方法。
您可能首先要考虑这是否有必要。由于 URL 是不可猜测的,因此如果您首先控制谁可以获取该 URL,那么您就可以控制对图像的访问。既然您已经限制了对它的访问,为什么还要将其设置为临时的?
关于java - Google Blobstore 提供的图像的 Google Appengine 签名或临时 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34271208/