summaryrefslogtreecommitdiffstats
path: root/nova/wsgi.py
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2011-07-29 19:54:54 +0000
committerTarmac <>2011-07-29 19:54:54 +0000
commitbdcfaa5b927a096f507fb0f7e2d81989173957f8 (patch)
treea94a7f9bfb3a863f31f31fee2770bfbfa9bcd086 /nova/wsgi.py
parent6703e33a68d0653f486d679337b4dfc4239eba34 (diff)
parent277b63bd933f0c1bf9209f3c52d1e914fc1d2382 (diff)
downloadnova-bdcfaa5b927a096f507fb0f7e2d81989173957f8.tar.gz
nova-bdcfaa5b927a096f507fb0f7e2d81989173957f8.tar.xz
nova-bdcfaa5b927a096f507fb0f7e2d81989173957f8.zip
Round 1 of changes for keystone integration.
* Modified request context to allow it to hold all of the relevant data from the auth component. * Pulled out access to AuthManager from as many places as possible * Massive cleanup of unit tests * Made the openstack api fakes use fake Authentication by default There are now only a few places that are using auth manager: * Authentication middleware for ec2 api (will move to stand-alone middleware) * Authentication middleware for os api (will be deprecated in favor of keystone) * Accounts and Users apis for os (will be switched to keystone or deprecated) * Ec2 admin api for users and projects (will be removed) * Nova-manage user and project commands (will be deprecated and removed with AuthManager) * Tests that test the above sections (will be converted or removed with their relevant section) * Tests for auth manager * Pipelib (authman can be removed once ec2 stand-alone middleware is in place) * xen_api (for getting images from old objectstore. I think this can be removed) Vish
Diffstat (limited to 'nova/wsgi.py')
-rw-r--r--nova/wsgi.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/nova/wsgi.py b/nova/wsgi.py
index eae3afcb4..c8ddb97d7 100644
--- a/nova/wsgi.py
+++ b/nova/wsgi.py
@@ -274,6 +274,18 @@ class Middleware(Application):
return self.process_response(response)
+class InjectContext(Middleware):
+ """Add a 'nova.context' to WSGI environ."""
+ def __init__(self, context, *args, **kwargs):
+ self.context = context
+ super(InjectContext, self).__init__(*args, **kwargs)
+
+ @webob.dec.wsgify(RequestClass=Request)
+ def __call__(self, req):
+ req.environ['nova.context'] = self.context
+ return self.application
+
+
class Debug(Middleware):
"""Helper class for debugging a WSGI application.