0

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

I currently use Ruby API and I can access my object after authenticate. But for external End Users, I need to generate public URL for that object which is can be accessed without authentication process.

I tried to generate Temp URL with expiration, but I cannot find key for hexdigest() of HMAC. How can I found it? or is there any other way to get same result?

sio4
  • 362
  • 1
  • 5
  • 15

2 Answers2

1

I can do it using the swift client like this:

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'

Some reference pages: Here how to install and configure the swift client http://sldn.softlayer.com/es/blog/waelriac/Managing-SoftLayer-Object-Storage-Through-REST-APIs here how to create the temp URL http://luisbg.blogalia.com/historias/74348

I hope it helps

  • Yes, swift CLI is a option for human but I needed some programatic solution. so I did fork and wrote some codes. – sio4 Mar 21 '16 at 17:11
  • 1
    Oh! @nelson-raul-cabero-mendoza, I'm sorry if you feel bad for my comment. but I'm not a machine. I just use my machines with my code. :-) – sio4 Mar 21 '16 at 17:43
1

Answer myself.

I finally wrote a code for it, after doing some more search on it including:

  1. read related API codes from https://github.com/softlayer/softlayer-object-storage-ruby
  2. read http://sldn.softlayer.com/es/blog/waelriac/Managing-SoftLayer-Object-Storage-Through-REST-APIs
  3. after that, I found some hint from middle of the second document: the response Header contains this key!
    • X-Account-Meta-Temp-URL-Key

So, I wrote a code(method) for it and make pull request(https://github.com/softlayer/softlayer-object-storage-ruby/pull/10), and I hope it will merged soon. anyway, If it is not accepted (yet), you can found my code at https://github.com/c12g/softlayer-object-storage-ruby

sio4
  • 362
  • 1
  • 5
  • 15
  • I have checked more projects related on swift and object storage, but no one support it natively. – sio4 Mar 22 '16 at 23:07