Merge "Cached tokens aren't expired"

This commit is contained in:
Jenkins
2014-05-27 17:40:42 +00:00
committed by Gerrit Code Review
2 changed files with 3 additions and 4 deletions

View File

@@ -1014,7 +1014,7 @@ class AuthProtocol(object):
env_key = self._header_to_env_var(key)
return env.get(env_key, default)
def _cache_get(self, token_id, ignore_expires=False):
def _cache_get(self, token_id):
"""Return token information from cache.
If token is invalid raise InvalidUserToken
@@ -1077,7 +1077,7 @@ class AuthProtocol(object):
expires = timeutils.normalize_time(expires)
utcnow = timeutils.utcnow()
if ignore_expires or utcnow < expires:
if utcnow < expires:
self.LOG.debug('Returning cached token')
return data
else:

View File

@@ -718,8 +718,7 @@ class CommonAuthTokenMiddlewareTest(object):
def _get_cached_token(self, token):
token_id = cms.cms_hash_token(token)
# NOTE(vish): example tokens are expired so skip the expiration check.
return self.middleware._cache_get(token_id, ignore_expires=True)
return self.middleware._cache_get(token_id)
def test_memcache(self):
# NOTE(jamielennox): it appears that httpretty can mess with the