'Constructs an appropriate context from extracted auth information.
Extract any authentication information in the request and construct an
appropriate context from it.'

def process_request(self, req):

    headers = req.headers
    environ = req.environ
    username = None
    password = None
    aws_creds = None
    user_domain = None
    project_domain = None
    if (headers.get('X-Auth-User') is not None):
        username = headers.get('X-Auth-User')
        password = headers.get('X-Auth-Key')
    elif (headers.get('X-Auth-EC2-Creds') is not None):
        aws_creds = headers.get('X-Auth-EC2-Creds')
    if (headers.get('X-User-Domain-Id') is not None):
        user_domain = headers.get('X-User-Domain-Id')
    if (headers.get('X-Project-Domain-Id') is not None):
        project_domain = headers.get('X-Project-Domain-Id')
    project_name = headers.get('X-Project-Name')
    region_name = headers.get('X-Region-Name')
    auth_url = headers.get('X-Auth-Url')
    token_info = environ.get('keystone.token_info')
    auth_plugin = environ.get('keystone.token_auth')
    req_id = environ.get(oslo_request_id.ENV_REQUEST_ID)
    req.context = self.ctxcls.from_environ(environ, project_name=project_name, aws_creds=aws_creds, username=username, password=password, auth_url=auth_url, request_id=req_id, user_domain=user_domain, project_domain=project_domain, auth_token_info=token_info, region_name=region_name, auth_plugin=auth_plugin)
