summaryrefslogtreecommitdiff
path: root/keystoneclient/v3/tokens.py
diff options
context:
space:
mode:
authorBrant Knudson <bknudson@us.ibm.com>2015-08-06 09:37:43 -0500
committerBrant Knudson <bknudson@us.ibm.com>2015-08-06 09:37:43 -0500
commit4e498a54d0034b2ce5c87130f080ff580d241600 (patch)
treed21d11091373e80bf1a4f70ecf1ee54ff82e0ff8 /keystoneclient/v3/tokens.py
parentd5c5423d6de3710e3480e47062333b33e8de0713 (diff)
parenteae8e83f5a7a170b98ef2d74a4ffd9eac7cc47ba (diff)
downloadpython-keystoneclient-feature/keystoneauth_integration.tar.gz
Merge remote-tracking branch 'origin/master' into merge-branchfeature/keystoneauth_integration
Conflicts: keystoneclient/exceptions.py keystoneclient/fixture/discovery.py keystoneclient/fixture/v2.py keystoneclient/fixture/v3.py keystoneclient/middleware/auth_token.py keystoneclient/middleware/s3_token.py keystoneclient/tests/unit/test_auth_token_middleware.py keystoneclient/tests/unit/test_memcache_crypt.py keystoneclient/tests/unit/test_s3_token_middleware.py requirements.txt test-requirements.txt Change-Id: Ib51acebaac7966bf37c1562fa15b9061df6a7aa5
Diffstat (limited to 'keystoneclient/v3/tokens.py')
-rw-r--r--keystoneclient/v3/tokens.py31
1 files changed, 21 insertions, 10 deletions
diff --git a/keystoneclient/v3/tokens.py b/keystoneclient/v3/tokens.py
index 77edbc0..38f4e9f 100644
--- a/keystoneclient/v3/tokens.py
+++ b/keystoneclient/v3/tokens.py
@@ -52,6 +52,25 @@ class TokenManager(object):
return body
@utils.positional.method(1)
+ def get_token_data(self, token, include_catalog=True):
+ """Fetch the data about a token from the identity server.
+
+ :param str token: The token id.
+ :param bool include_catalog: If False, the response is requested to not
+ include the catalog.
+
+ :rtype: dict
+ """
+ headers = {'X-Subject-Token': token}
+
+ url = '/auth/tokens'
+ if not include_catalog:
+ url += '?nocatalog'
+
+ resp, body = self._client.get(url, headers=headers)
+ return body
+
+ @utils.positional.method(1)
def validate(self, token, include_catalog=True):
"""Validate a token.
@@ -66,13 +85,5 @@ class TokenManager(object):
"""
token_id = _calc_id(token)
- headers = {'X-Subject-Token': token_id}
-
- url = '/auth/tokens'
- if not include_catalog:
- url += '?nocatalog'
-
- resp, body = self._client.get(url, headers=headers)
-
- access_info = access.AccessInfo.factory(resp=resp, body=body)
- return access_info
+ body = self.get_token_data(token_id, include_catalog=include_catalog)
+ return access.AccessInfo.factory(auth_token=token_id, body=body)