From d99e8f33da8a29b91ee771763b69dc855c2e92b3 Mon Sep 17 00:00:00 2001 From: Tatiana Kholkina Date: Tue, 2 Oct 2018 13:06:53 +0300 Subject: [PATCH] Do not pass www_authenticate_uri to RequestContext Change-Id: I0ee32031d714608c33643b12b1e217a04157f5b3 Closes-Bug: #1795613 (cherry picked from commit f0b96b8a3748e70565e813ea65dcbc441355c6dc) --- watcher/api/hooks.py | 7 ------- watcher/common/context.py | 7 +++---- watcher/tests/api/test_hooks.py | 3 --- watcher/tests/base.py | 3 --- watcher/tests/fakes.py | 1 - 5 files changed, 3 insertions(+), 18 deletions(-) diff --git a/watcher/api/hooks.py b/watcher/api/hooks.py index 6a398ab3f..5bfd514e7 100644 --- a/watcher/api/hooks.py +++ b/watcher/api/hooks.py @@ -16,7 +16,6 @@ from oslo_config import cfg -from oslo_utils import importutils from pecan import hooks from six.moves import http_client @@ -60,14 +59,8 @@ class ContextHook(hooks.PecanHook): roles = (headers.get('X-Roles', None) and headers.get('X-Roles').split(',')) - auth_url = headers.get('X-Auth-Url') - if auth_url is None: - importutils.import_module('keystonemiddleware.auth_token') - auth_url = cfg.CONF.keystone_authtoken.www_authenticate_uri - state.request.context = context.make_context( auth_token=auth_token, - auth_url=auth_url, auth_token_info=auth_token_info, user=user, user_id=user_id, diff --git a/watcher/common/context.py b/watcher/common/context.py index 79da28d5c..44f941ead 100644 --- a/watcher/common/context.py +++ b/watcher/common/context.py @@ -23,9 +23,9 @@ class RequestContext(context.RequestContext): def __init__(self, user_id=None, project_id=None, is_admin=None, roles=None, timestamp=None, request_id=None, auth_token=None, - auth_url=None, overwrite=True, user_name=None, - project_name=None, domain_name=None, domain_id=None, - auth_token_info=None, **kwargs): + overwrite=True, user_name=None, project_name=None, + domain_name=None, domain_id=None, auth_token_info=None, + **kwargs): """Stores several additional request parameters: :param domain_id: The ID of the domain. @@ -70,7 +70,6 @@ class RequestContext(context.RequestContext): # FIXME(dims): user_id and project_id duplicate information that is # already present in the oslo_context's RequestContext. We need to # get rid of them. - self.auth_url = auth_url self.domain_name = domain_name self.domain_id = domain_id self.auth_token_info = auth_token_info diff --git a/watcher/tests/api/test_hooks.py b/watcher/tests/api/test_hooks.py index 6e73700b6..5ae229c3b 100644 --- a/watcher/tests/api/test_hooks.py +++ b/watcher/tests/api/test_hooks.py @@ -222,7 +222,6 @@ class TestContextHook(base.FunctionalTest): user_id=headers['X-User-Id'], domain_id=headers['X-User-Domain-Id'], domain_name=headers['X-User-Domain-Name'], - auth_url=cfg.CONF.keystone_authtoken.www_authenticate_uri, project=headers['X-Project-Name'], project_id=headers['X-Project-Id'], show_deleted=None, @@ -243,7 +242,6 @@ class TestContextHook(base.FunctionalTest): user_id=headers['X-User-Id'], domain_id=headers['X-User-Domain-Id'], domain_name=headers['X-User-Domain-Name'], - auth_url=cfg.CONF.keystone_authtoken.www_authenticate_uri, project=headers['X-Project-Name'], project_id=headers['X-Project-Id'], show_deleted=None, @@ -265,7 +263,6 @@ class TestContextHook(base.FunctionalTest): user_id=headers['X-User-Id'], domain_id=headers['X-User-Domain-Id'], domain_name=headers['X-User-Domain-Name'], - auth_url=cfg.CONF.keystone_authtoken.www_authenticate_uri, project=headers['X-Project-Name'], project_id=headers['X-Project-Id'], show_deleted=None, diff --git a/watcher/tests/base.py b/watcher/tests/base.py index 94cd4ef19..1e4b9bb2e 100644 --- a/watcher/tests/base.py +++ b/watcher/tests/base.py @@ -60,9 +60,6 @@ class TestCase(BaseTestCase): cfg.CONF.set_override("auth_type", "admin_token", group='keystone_authtoken') - cfg.CONF.set_override("www_authenticate_uri", - "http://127.0.0.1/identity", - group='keystone_authtoken') app_config_path = os.path.join(os.path.dirname(__file__), 'config.py') self.app = testing.load_test_app(app_config_path) diff --git a/watcher/tests/fakes.py b/watcher/tests/fakes.py index d35b10dea..24ed570f7 100644 --- a/watcher/tests/fakes.py +++ b/watcher/tests/fakes.py @@ -20,7 +20,6 @@ fakeAuthTokenHeaders = {'X-User-Id': u'773a902f022949619b5c2f32cd89d419', 'X-Auth-Token': u'5588aebbcdc24e17a061595f80574376', 'X-Forwarded-For': u'10.10.10.10, 11.11.11.11', 'X-Service-Catalog': u'{test: 12345}', - 'X-Auth-Url': 'fake_auth_url', 'X-Identity-Status': 'Confirmed', 'X-User-Domain-Name': 'domain', 'X-Project-Domain-Id': 'project_domain_id',