diff --git a/keystone/service.py b/keystone/service.py index 2b024f4ed9..ebdea50af8 100644 --- a/keystone/service.py +++ b/keystone/service.py @@ -351,7 +351,8 @@ class TokenController(wsgi.Application): context, token_id, dict(id=token_id, user=user_ref, tenant=tenant_ref, - metadata=metadata_ref)) + metadata=metadata_ref, + expires=old_token_ref['expires'])) # TODO(termie): optimize this call at some point and put it into the # the return for metadata diff --git a/tests/test_keystoneclient.py b/tests/test_keystoneclient.py index 68f190fae4..dc26c95967 100644 --- a/tests/test_keystoneclient.py +++ b/tests/test_keystoneclient.py @@ -14,6 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. +import time import uuid import nose.exc @@ -333,6 +334,17 @@ class KeystoneClientTests(object): self.get_client, self.user_foo) + def test_token_expiry_maintained(self): + foo_client = self.get_client(self.user_foo) + orig_token = foo_client.service_catalog.catalog['token'] + + time.sleep(1.01) + reauthenticated_token = foo_client.tokens.authenticate( + token=foo_client.auth_token) + + self.assertEquals(orig_token['expires'], + reauthenticated_token.expires) + def test_user_create_update_delete(self): from keystoneclient import exceptions as client_exceptions