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:
Jamie Lennox
2016-09-30 10:26:21 +10:00
parent 40f9b0ad16
commit 6d026c1c3e

View File

@@ -18,7 +18,6 @@ Common Auth Middleware.
from oslo_log import log as logging
from oslo_log import versionutils
from oslo_middleware import request_id
from oslo_serialization import jsonutils
import webob.dec
import webob.exc
@@ -76,10 +75,6 @@ class NovaKeystoneContext(wsgi.Middleware):
@webob.dec.wsgify(RequestClass=wsgi.Request)
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...
remote_address = req.remote_addr
if CONF.use_forwarded_for:
@@ -100,12 +95,9 @@ class NovaKeystoneContext(wsgi.Middleware):
ctx = context.RequestContext.from_environ(
req.environ,
user_name=user_name,
project_name=project_name,
user_auth_plugin=user_auth_plugin,
remote_address=remote_address,
service_catalog=service_catalog,
request_id=req_id)
service_catalog=service_catalog)
if ctx.user_id is None:
LOG.debug("Neither X_USER_ID nor X_USER found in request")