diff options
| author | Kevin L. Mitchell <kevin.mitchell@rackspace.com> | 2011-03-18 02:09:46 +0000 |
|---|---|---|
| committer | Kevin L. Mitchell <kevin.mitchell@rackspace.com> | 2011-03-18 02:09:46 +0000 |
| commit | 4453021476fac599c0cee126b6eaa426d4878145 (patch) | |
| tree | 5477bc3acb6634d2ae61e04b085a2c7e34966900 /nova/api | |
| parent | 645bc7a7dea6ba01d76589632200636e243641ec (diff) | |
| download | nova-4453021476fac599c0cee126b6eaa426d4878145.tar.gz nova-4453021476fac599c0cee126b6eaa426d4878145.tar.xz nova-4453021476fac599c0cee126b6eaa426d4878145.zip | |
Copy over to current trunk my tests, the 401/500 fix, and a couple of
fixes to the committed fix which was actually brittle around the edges...
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 |
