summaryrefslogtreecommitdiff
path: root/keystoneclient/access.py
diff options
context:
space:
mode:
authorJamie Lennox <jamielennox@redhat.com>2014-06-18 14:53:01 +1000
committerJamie Lennox <jamielennox@redhat.com>2014-06-30 09:17:04 +1000
commit3d29db1bd1274e54097ee9387987f9b64ed8b3d0 (patch)
tree32f782eae0c0765c90d8b20b1f9c237dbb3f6fd1 /keystoneclient/access.py
parent90abb4cfb2c133fda1df5da11d8fc30ec9e5514b (diff)
downloadpython-keystoneclient-3d29db1bd1274e54097ee9387987f9b64ed8b3d0.tar.gz
Add OAuth data to AccessInfo
Allow access to the access_token_id and the consumer_id that are set as part of the Oauth authentication process. This only makes sense for V3 tokens, as Oauth cannot be used with v2. Change-Id: I9ac76f92acdfd6446a13f535b24e0a99f02f2eef
Diffstat (limited to 'keystoneclient/access.py')
-rw-r--r--keystoneclient/access.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/keystoneclient/access.py b/keystoneclient/access.py
index 8e123a3..354ccec 100644
--- a/keystoneclient/access.py
+++ b/keystoneclient/access.py
@@ -337,6 +337,22 @@ class AccessInfo(dict):
"""
return self.get('version')
+ @property
+ def oauth_access_token_id(self):
+ """Return the access token ID if OAuth authentication used.
+
+ :returns: str or None.
+ """
+ raise NotImplementedError()
+
+ @property
+ def oauth_consumer_id(self):
+ """Return the consumer ID if OAuth authentication used.
+
+ :returns: str or None.
+ """
+ raise NotImplementedError()
+
class AccessInfoV2(AccessInfo):
"""An object for encapsulating a raw v2 auth token from identity
@@ -505,6 +521,14 @@ class AccessInfoV2(AccessInfo):
else:
return None
+ @property
+ def oauth_access_token_id(self):
+ return None
+
+ @property
+ def oauth_consumer_id(self):
+ return None
+
class AccessInfoV3(AccessInfo):
"""An object for encapsulating a raw v3 auth token from identity
@@ -647,3 +671,11 @@ class AccessInfoV3(AccessInfo):
else:
return None
+
+ @property
+ def oauth_access_token_id(self):
+ return self.get('OS-OAUTH1', {}).get('access_token_id')
+
+ @property
+ def oauth_consumer_id(self):
+ return self.get('OS-OAUTH1', {}).get('consumer_id')