Add X-Auth-Token-Lifetime and user_set_tokenlifetime option

This commit is contained in:
Christian Schwede 2013-02-15 16:46:21 +01:00
parent 97fe391995
commit ce1072bc97
1 changed files with 7 additions and 0 deletions

View File

@ -1245,6 +1245,13 @@ class Swauth(object):
# Save token info
path = quote('/v1/%s/.token_%s/%s' %
(self.auth_account, token[-1], token))
if self.conf.get('user_set_tokenlifetime', False):
try:
self.token_life = int(req.headers.get('x-auth-token-lifetime'))
except (TypeError, ValueError):
pass
resp = self.make_pre_authed_request(
req.environ, 'PUT', path,
json.dumps({'account': account, 'user': user,