Remove manual handling of old context variables
In later versions of oslo.context the from_environ method will pick up these variables [1] so we don't need to handle them manually here. [1] https://github.com/openstack/oslo.context/blob/2.9.0/oslo_context/context.py#L51 Change-Id: Ie0634695ae3e5503f1853f428542827b0264cfe3
This commit is contained in:
		| @@ -18,7 +18,6 @@ Common Auth Middleware. | |||||||
|  |  | ||||||
| from oslo_log import log as logging | from oslo_log import log as logging | ||||||
| from oslo_log import versionutils | from oslo_log import versionutils | ||||||
| from oslo_middleware import request_id |  | ||||||
| from oslo_serialization import jsonutils | from oslo_serialization import jsonutils | ||||||
| import webob.dec | import webob.dec | ||||||
| import webob.exc | import webob.exc | ||||||
| @@ -76,10 +75,6 @@ class NovaKeystoneContext(wsgi.Middleware): | |||||||
|  |  | ||||||
|     @webob.dec.wsgify(RequestClass=wsgi.Request) |     @webob.dec.wsgify(RequestClass=wsgi.Request) | ||||||
|     def __call__(self, req): |     def __call__(self, req): | ||||||
|         project_name = req.headers.get('X_TENANT_NAME') |  | ||||||
|         user_name = req.headers.get('X_USER_NAME') |  | ||||||
|         req_id = req.environ.get(request_id.ENV_REQUEST_ID) |  | ||||||
|  |  | ||||||
|         # Build a context, including the auth_token... |         # Build a context, including the auth_token... | ||||||
|         remote_address = req.remote_addr |         remote_address = req.remote_addr | ||||||
|         if CONF.use_forwarded_for: |         if CONF.use_forwarded_for: | ||||||
| @@ -100,12 +95,9 @@ class NovaKeystoneContext(wsgi.Middleware): | |||||||
|  |  | ||||||
|         ctx = context.RequestContext.from_environ( |         ctx = context.RequestContext.from_environ( | ||||||
|             req.environ, |             req.environ, | ||||||
|             user_name=user_name, |  | ||||||
|             project_name=project_name, |  | ||||||
|             user_auth_plugin=user_auth_plugin, |             user_auth_plugin=user_auth_plugin, | ||||||
|             remote_address=remote_address, |             remote_address=remote_address, | ||||||
|             service_catalog=service_catalog, |             service_catalog=service_catalog) | ||||||
|             request_id=req_id) |  | ||||||
|  |  | ||||||
|         if ctx.user_id is None: |         if ctx.user_id is None: | ||||||
|             LOG.debug("Neither X_USER_ID nor X_USER found in request") |             LOG.debug("Neither X_USER_ID nor X_USER found in request") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jamie Lennox
					Jamie Lennox