diff options
| author | Rick Harris <rick.harris@rackspace.com> | 2011-02-28 16:25:01 +0000 |
|---|---|---|
| committer | Rick Harris <rick.harris@rackspace.com> | 2011-02-28 16:25:01 +0000 |
| commit | d6215666fa28a1dd7368aa32bc1ae9f3ca872fab (patch) | |
| tree | 211ee849cddca17f4eebf0bf1ee151b4b0bbd1cc /nova/api | |
| parent | 7ae64e06643025e4945ae0ef056f9fb2184904ff (diff) | |
| parent | edf5da85648659b1a7ad105248d69ef9f8c977e4 (diff) | |
Merging trunk
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/auth.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py index dff69a7f2..6011e6115 100644 --- a/nova/api/openstack/auth.py +++ b/nova/api/openstack/auth.py @@ -26,6 +26,7 @@ import webob.dec from nova import auth from nova import context from nova import db +from nova import exception from nova import flags from nova import manager from nova import utils @@ -103,11 +104,14 @@ class AuthMiddleware(wsgi.Middleware): 2 days ago. """ ctxt = context.get_admin_context() - token = self.db.auth_token_get(ctxt, token_hash) + try: + token = self.db.auth_token_get(ctxt, token_hash) + except exception.NotFound: + return None if token: delta = datetime.datetime.now() - token.created_at if delta.days >= 2: - self.db.auth_token_destroy(ctxt, token.id) + self.db.auth_token_destroy(ctxt, token.token_hash) else: return self.auth.get_user(token.user_id) return None |
