编程语言
首页 > 编程语言> > c# – 如何保护天蓝色斑点

c# – 如何保护天蓝色斑点

作者:互联网

我正在使用windows azure blob存储服务.我想保护我的blob免受公共访问(除了我的用户).为此我使用共享访问签名(SAS),它工作正常.但我的问题是我有一个容器,它在目录结构中包含blob,如:

  https://xxxxxxx.blob.core.windows.net/myContainer/directory1/blob1
  https://xxxxxxx.blob.core.windows.net/myContainer/directory1/blob2
  https://xxxxxxx.blob.core.windows.net/myContainer/directory1/blob3
  https://xxxxxxx.blob.core.windows.net/myContainer/directory1/blob4
  https://xxxxxxx.blob.core.windows.net/myContainer/directory1/blob5

  https://xxxxxxx.blob.core.windows.net/myContainer/directory2/blob1       
  https://xxxxxxx.blob.core.windows.net/myContainer/directory2/blob2      
  https://xxxxxxx.blob.core.windows.net/myContainer/directory2/blob3      
  https://xxxxxxx.blob.core.windows.net/myContainer/directory2/blob4      
  https://xxxxxxx.blob.core.windows.net/myContainer/directory2/blob5

  and so on...

现在我的要求是,我希望公开访问directory2下myContainer中的所有blob,但不能访问directory1下的blob,我希望将directory1下的所有blob保持为私有.我怎样才能实现这一目标?

解决方法:

您可以创建两个容器.

一个私有容器,其容器级别为SAS,另一个为公共访问容器

  https://xxxxxxx.blob.core.windows.net/private/blob1
  https://xxxxxxx.blob.core.windows.net/private/blob2
  https://xxxxxxx.blob.core.windows.net/private/blob3
  https://xxxxxxx.blob.core.windows.net/private/blob4
  https://xxxxxxx.blob.core.windows.net/private/blob5

  https://xxxxxxx.blob.core.windows.net/public/blob1       
  https://xxxxxxx.blob.core.windows.net/public/blob2      
  https://xxxxxxx.blob.core.windows.net/public/blob3      
  https://xxxxxxx.blob.core.windows.net/public/blob4      
  https://xxxxxxx.blob.core.windows.net/public/blob5

标签:c,azure,azure-storage-blobs,azure-storage
来源: https://codeday.me/bug/20190517/1123319.html