summaryrefslogtreecommitdiff
path: root/keystoneclient/access.py
diff options
context:
space:
mode:
authorJamie Lennox <jamielennox@redhat.com>2014-06-18 11:19:36 +1000
committerJamie Lennox <jamielennox@redhat.com>2014-06-19 10:46:27 +1000
commit588aaa3eaac302a1d8f60cce77103e9ac682fae8 (patch)
treed54cba5efe543d2d246da6f8958f73c8ce0c103d /keystoneclient/access.py
parent0aa9df3b76d85706c12320eaa199aa52eaafebb3 (diff)
downloadpython-keystoneclient-588aaa3eaac302a1d8f60cce77103e9ac682fae8.tar.gz
Add issued handlers to auth_ref and fixtures
issued_at is a standard part of V2 and V3 tokens so add it to AccessInfo in a similar way to expiry. Also it should be included when generating tokens so include it in fixtures. Change-Id: I0d62d8ce6472466886751e10e98046b8e398e079
Diffstat (limited to 'keystoneclient/access.py')
-rw-r--r--keystoneclient/access.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/keystoneclient/access.py b/keystoneclient/access.py
index 3ef4d72..8e123a3 100644
--- a/keystoneclient/access.py
+++ b/keystoneclient/access.py
@@ -121,6 +121,14 @@ class AccessInfo(dict):
raise NotImplementedError()
@property
+ def issued(self):
+ """Returns the token issue time (as datetime object)
+
+ :returns: datetime
+ """
+ raise NotImplementedError()
+
+ @property
def username(self):
"""Returns the username associated with the authentication request.
Follows the pattern defined in the V2 API of first looking for 'name',
@@ -364,6 +372,10 @@ class AccessInfoV2(AccessInfo):
return timeutils.parse_isotime(self['token']['expires'])
@property
+ def issued(self):
+ return timeutils.parse_isotime(self['token']['issued_at'])
+
+ @property
def username(self):
return self['user'].get('name', self['user'].get('username'))
@@ -530,6 +542,10 @@ class AccessInfoV3(AccessInfo):
return timeutils.parse_isotime(self['expires_at'])
@property
+ def issued(self):
+ return timeutils.parse_isotime(self['issued_at'])
+
+ @property
def user_id(self):
return self['user']['id']