summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/auth.py8
-rw-r--r--nova/api/ec2/__init__.py5
2 files changed, 11 insertions, 2 deletions
diff --git a/nova/api/auth.py b/nova/api/auth.py
index d8b5342c6..81e0a0377 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 11fa9d6d5..9613d0f8b 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