summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrant Knudson <bknudson@us.ibm.com>2014-12-15 17:19:03 -0600
committerBrant Knudson <bknudson@us.ibm.com>2014-12-16 08:53:29 -0600
commit979b3fc495fe9f07488a537623185f7a0db18052 (patch)
tree2bafc8851ca8458bdf560725b491909f1ec69d31
parent81e48d44ff79d58ec6b983f475ff008c9f7f3b0e (diff)
downloadpython-keystoneclient-979b3fc495fe9f07488a537623185f7a0db18052.tar.gz
Add fetch revocations for v2.0
There was no API to fetch revocations using v2.0. bp auth-token-use-client Change-Id: Ica5aae5b9075180223268fb6b2ef11e00dfd057f
-rw-r--r--keystoneclient/tests/v2_0/test_tokens.py7
-rw-r--r--keystoneclient/v2_0/tokens.py10
2 files changed, 17 insertions, 0 deletions
diff --git a/keystoneclient/tests/v2_0/test_tokens.py b/keystoneclient/tests/v2_0/test_tokens.py
index 688972b..3351273 100644
--- a/keystoneclient/tests/v2_0/test_tokens.py
+++ b/keystoneclient/tests/v2_0/test_tokens.py
@@ -160,3 +160,10 @@ class TokenTests(utils.TestCase):
self.assertIsInstance(token_ref, tokens.Token)
self.assertEqual(token_fixture.token_id, token_ref.id)
self.assertEqual(token_fixture.expires_str, token_ref.expires)
+
+ def test_get_revoked(self):
+ sample_revoked_response = {'signed': '-----BEGIN CMS-----\nMIIB...'}
+ self.stub_url('GET', ['tokens', 'revoked'],
+ json=sample_revoked_response)
+ resp = self.client.tokens.get_revoked()
+ self.assertEqual(sample_revoked_response, resp)
diff --git a/keystoneclient/v2_0/tokens.py b/keystoneclient/v2_0/tokens.py
index fb48738..ed1c07e 100644
--- a/keystoneclient/v2_0/tokens.py
+++ b/keystoneclient/v2_0/tokens.py
@@ -72,3 +72,13 @@ class TokenManager(base.Manager):
def endpoints(self, token):
return self._get("/tokens/%s/endpoints" % base.getid(token), "token")
+
+ def get_revoked(self):
+ """Returns the revoked tokens response.
+
+ The response will be a dict containing 'signed' which is a CMS-encoded
+ document.
+
+ """
+ resp, body = self.client.get('/tokens/revoked')
+ return body