简体   繁体   English

如何为Azure存储表集表服务属性终结点构造规范资源?

[英]How can I construct canonical resource for Azure Storage Table Set Table Service Properties endpoint?

Azure exposes an endpoint to set table service properties . Azure公开了一个端点来设置表服务属性 This endpoint expects client to pass Authorization header and that could be formatted as SharedKeyLite <account-name>:<signature> for Table services as explained here . 此端点希望客户通过Authorization头和可能被格式化为SharedKeyLite <account-name>:<signature>的解释了表服务在这里 signature is the sha256 encoded form of <date>\\n<canonical-resource> for which canonical resource construction follows the rules: signature<date>\\n<canonical-resource>的sha256编码形式,其规范资源构造遵循以下规则:

  1. Beginning with an empty string (""), append a forward slash (/), followed by the name of the account that owns the resource being accessed. 以空字符串(“”)开头,在斜杠(/)后面加上拥有所访问资源的帐户名称。
  2. Append the resource's encoded URI path. 附加资源的编码URI路径。 If the request URI addresses a component of the resource, append the appropriate query string. 如果请求URI寻址资源的一部分,请附加适当的查询字符串。 The query string should include the question mark and the comp parameter (for example, ?comp=metadata). 查询字符串应包含问号和comp参数(例如,?comp = metadata)。 No other parameters should be included on the query string. 查询字符串中不应包含其他任何参数。

according to Authentication documentation . 根据认证文档

I am able to authenticate for query tables or entity operations . 我能够对查询表实体操作进行身份验证。 However, I am consistently failing to authenticate for set table service properties endpoint. 但是, 我始终无法通过身份验证设置表服务属性端点。 I construct canonical resource by starting with "/<account-name>" according to rule 1 and then I append another "/" without any query string, because I believe request URI (which is https://<account-name>.table.core.windows.net/?restype=service&comp=properties ) is not addressing a component according to rule 2 . 我根据规则1"/<account-name>"开头来构造规范资源,然后在不附加任何查询字符串的情况下附加另一个"/" ,因为我相信请求URI( https://<account-name>.table.core.windows.net/?restype=service&comp=properties )未根据规则2寻址组件。 That makes canonical resource "/<account-name>/" . 这就是规范资源"/<account-name>/"

Is there anybody managed to authenticate for this endpoint at all? 是否有人设法对此端点进行身份验证? If so how? 如果可以,怎么办?

NOTE 1: I tried otherwise (appended query string too and that made the canonical resource "/<account-name>/?comp=properties" ), but failed again. 注意1:我尝试了其他方法(也添加了查询字符串,使之成为标准资源"/<account-name>/?comp=properties" ),但是又失败了。

NOTE 2: Rule 2 asks to append encoded URI path, but that is not really the case. 注意2: 规则2要求附加编码的URI路径,但实际上并非如此。

I was able to partially resolve the issue. 我能够部分解决问题。 The problem is Azure storage emulator behaves different than the actual storage service. 问题是Azure存储模拟器的行为不同于实际的存储服务。 Set Table Service Properties endpoint is not authenticating the request on the emulator whereas it goes through fine on the service itself. 设置表服务属性端点未在模拟器上对请求进行身份验证,而该请求在服务本身上运行正常。 Other requests against table (read, create, delete) and entities (create, read, update and delete) are behaving same on emulator and service. 针对表(读取,创建,删除)和实体(创建,读取,更新和删除)的其他请求在模拟器和服务上的行为相同。

The canonical resource is formatted as "/<account-name>/?comp=properties" . 规范资源的格式为"/<account-name>/?comp=properties" Content type makes no difference in authentication as expected. 内容类型与预期的身份验证没有区别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM