如何为 SoftLayer 的对象存储上的对象生成 TempURL

How can I generate TempURL for object on Object Storage of SoftLayer

如何为 SoftLayer 的对象存储上的对象生成 TempURL?

我目前使用 Ruby API,我可以在验证后访问我的对象。 但对于外部最终用户,我需要为无需身份验证过程即可访问的对象生成 public URL。

我尝试生成过期的临时文件 URL,但我找不到 HMAC 的 hexdigest() 的密钥。我怎样才能找到它?还是有其他方法可以得到相同的结果?

我可以这样使用 swift 客户端:

We add the temporary urls secret keys with the command: 
$ swift post -m "Temp-URL-Key:mykey"

We create the temporary URL:
$ swift-temp-url GET 3600 /v1/AUTH_d684780d-aafe-4772-bcbb-0f07d5f6edf3/a-container/data.txt mykey

it returns:
v1/AUTH_d684780d-aafe-4772-bcbb-0f07d5f6edf3/a-container/data.txt?temp_url_sig=19f067d38dc532883e8f02be3b43a172c61e51d2&temp_url_expires=1445615769

Then we can access to the file:
curl 'https://dal05.objectstorage.softlayer.net/v1/AUTH_d684780d-aafe-4772-bcbb-0f07d5f6edf3/a-container/data.txt?temp_url_sig=19f067d38dc532883e8f02be3b43a172c61e51d2&temp_url_expires=1445615769'

一些参考页面: 这里如何安装和配置 swift 客户端 http://sldn.softlayer.com/es/blog/waelriac/Managing-SoftLayer-Object-Storage-Through-REST-APIs 此处如何创建临时文件 URL http://luisbg.blogalia.com/historias/74348

希望对你有帮助

自己回答。

我终于为它写了一个代码,在对它进行了更多搜索之后,包括:

  1. 阅读 https://github.com/softlayer/softlayer-object-storage-ruby
  2. 中的相关 API 代码
  3. 阅读http://sldn.softlayer.com/es/blog/waelriac/Managing-SoftLayer-Object-Storage-Through-REST-APIs
  4. 之后,我从第二个文档的中间发现了一些提示:响应头中包含这个键!
    • X-Account-Meta-Temp-URL-Key

所以,我为它写了一个代码(方法)并提出了拉取请求(https://github.com/softlayer/softlayer-object-storage-ruby/pull/10),希望它能尽快合并。 无论如何,如果它(还)没有被接受,你可以在 https://github.com/c12g/softlayer-object-storage-ruby

找到我的代码