diff options
| author | Anthony Young <sleepsonthefloor@gmail.com> | 2012-06-29 21:32:08 -0600 |
|---|---|---|
| committer | John Griffith <john.griffith@solidfire.com> | 2012-07-02 20:00:32 -0600 |
| commit | 94a34e0e69a520e403a2d8e579186fad9acf14c7 (patch) | |
| tree | 62687aea6ca8ee127a1dcc4e7495d9ea60168ac3 /nova/api | |
| parent | 2038e933bd8bde659e31b4a78e2211a585e3dcec (diff) | |
Add ServiceCatalog entries to enable Cinder usage
* Part of of blueprint extract-nova-volumes
* Adds usage of service catalog to ec2
* Adds entries to auth.py
* Implements tests for new authorization mods
Change-Id: I2efb375bbb130cde6a1ba119fa862ca45b126a1e
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/auth.py | 8 | ||||
| -rw-r--r-- | nova/api/ec2/__init__.py | 5 |
2 files changed, 11 insertions, 2 deletions
diff --git a/nova/api/auth.py b/nova/api/auth.py index 72eba1d9c..c0ea1680d 100644 --- a/nova/api/auth.py +++ b/nova/api/auth.py @@ -18,6 +18,7 @@ Common Auth Middleware. """ +import json import webob.dec import webob.exc @@ -95,13 +96,18 @@ class NovaKeystoneContext(wsgi.Middleware): remote_address = req.remote_addr if FLAGS.use_forwarded_for: remote_address = req.headers.get('X-Forwarded-For', remote_address) + + if req.headers.get('X_SERVICE_CATALOG') is not None: + service_catalog = json.loads(req.headers.get('X_SERVICE_CATALOG')) + ctx = context.RequestContext(user_id, project_id, user_name=user_name, project_name=project_name, roles=roles, auth_token=auth_token, - remote_address=remote_address) + remote_address=remote_address, + service_catalog=service_catalog) req.environ['nova.context'] = ctx return self.application diff --git a/nova/api/ec2/__init__.py b/nova/api/ec2/__init__.py index 6bb19e7b3..d21c575cd 100644 --- a/nova/api/ec2/__init__.py +++ b/nova/api/ec2/__init__.py @@ -261,13 +261,16 @@ class EC2KeystoneAuth(wsgi.Middleware): if FLAGS.use_forwarded_for: remote_address = req.headers.get('X-Forwarded-For', remote_address) + + catalog = result['access']['serviceCatalog'] ctxt = context.RequestContext(user_id, project_id, user_name=user_name, project_name=project_name, roles=roles, auth_token=token_id, - remote_address=remote_address) + remote_address=remote_address, + service_catalog=catalog) req.environ['nova.context'] = ctxt |
