Document requesting + caching auth tokens
Bug #1696236 reported by
wolever
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-swiftclient |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Currently there's no documentation around either:
1. Explicitly requesting an authentication token (the process for creating the Python objects is here - https:/
2. Explicitly caching and reusing those tokens (ex, saving a token to Redis so it can be shared by multiple app servers and refreshed out-of-band).
Changed in python-swiftclient: | |
status: | New → Confirmed |
To post a comment you must log in.
Agreed on the lack of documentation around this. I looked into the client functions a little bit tonight and came up with the following:
>>> import swiftclient client. get_auth( 'http:// localhost: 32780/auth/ v1.0', 'test:tester', 'testing') client. Connection( preauthurl= storage_ url, preauthtoken= auth_token) container( 'test') 55304', u'x-openstack- request- id': u'tx1895dbebda3 e452dab2b8- 00593a485e' }
>>> storage_url, auth_token = swiftclient.
>>> conn = swiftclient.
>>> conn.head_
{[...] u'x-timestamp': u'1496991830.
I think the same approach works with the v2 authentication, but I haven't tested that. I've only tried with v1 auth in the docker-swift container, but the code for swiftclient. client. get_auth seems like it supports v2 Keystone auth as well. Would this work for you to store the storage URL and auth token in Redis or some other caching layer?