Cleanup TODO about auth.controller code moved to core

Cleaned up TODO for code moved from auth.controllers to auth.core
in relation to Auth Method Plugin loading.

Change-Id: I319607f9b6845348515755b658f4ab6cef5cde37
This commit is contained in:
Morgan Fainberg 2017-01-29 14:00:30 -08:00
parent b17c3a5032
commit 1451659e48
5 changed files with 9 additions and 14 deletions

View File

@ -37,11 +37,6 @@ LOG = log.getLogger(__name__)
CONF = keystone.conf.CONF
# TODO(notmorgan): Update all references to the following functions to
# reference auth.core instead of auth.controllers
get_auth_method = core.get_auth_method
load_auth_method = core.load_auth_method
load_auth_methods = core.load_auth_methods
# TODO(notmorgan): Move Common Auth Code (AuthContext and AuthInfo)
# loading into keystone.auth.core (and update all references to the new
@ -524,7 +519,7 @@ class Auth(controller.V3Controller):
# dropping it, so this must be filtered out
if request.remote_user:
try:
external = get_auth_method('external')
external = core.get_auth_method('external')
resp = external.authenticate(request,
auth_info)
if resp and resp.status:
@ -553,7 +548,7 @@ class Auth(controller.V3Controller):
# are specified
auth_response = {'methods': []}
for method_name in auth_info.get_method_names():
method = get_auth_method(method_name)
method = core.get_auth_method(method_name)
resp = method.authenticate(request,
auth_info.get_method_data(method_name))
if resp:

View File

@ -68,6 +68,6 @@ def load_backends():
trust_api=trust.Manager(),
token_provider_api=token.provider.Manager())
auth.controllers.load_auth_methods()
auth.core.load_auth_methods()
return DRIVERS

View File

@ -22,7 +22,7 @@ from oslo_utils import importutils
import stevedore
from stevedore import extension
from keystone.auth import controllers
from keystone.auth import core
from keystone.tests import unit
@ -48,7 +48,7 @@ class TestLoadAuthMethod(unit.BaseTestCase):
driver_manager_mock = self.useFixture(fixtures.MockPatchObject(
stevedore, 'DriverManager', return_value=fake_driver_manager)).mock
driver = controllers.load_auth_method(method)
driver = core.load_auth_method(method)
self.assertEqual(auth_plugin_namespace, fake_driver_manager.namespace)
driver_manager_mock.assert_called_once_with(
@ -72,7 +72,7 @@ class TestLoadAuthMethod(unit.BaseTestCase):
self.useFixture(fixtures.MockPatchObject(
importutils, 'import_object', return_value=mock.sentinel.driver))
driver = controllers.load_auth_method(method)
driver = core.load_auth_method(method)
self.assertIs(mock.sentinel.driver, driver)
def test_entrypoint_fails_import_fails(self):
@ -95,4 +95,4 @@ class TestLoadAuthMethod(unit.BaseTestCase):
self.useFixture(fixtures.MockPatchObject(
importutils, 'import_object', side_effect=TestException))
self.assertRaises(TestException, controllers.load_auth_method, method)
self.assertRaises(TestException, core.load_auth_method, method)

View File

@ -114,7 +114,7 @@ class TestAuthPlugin(unit.SQLDriverOverrides, unit.TestCase):
self.useFixture(
auth_plugins.ConfigAuthPlugins(self.config_fixture,
['external', 'external']))
auth.controllers.load_auth_methods()
auth.core.load_auth_methods()
self.assertIn('external', auth.core.AUTH_METHODS)

View File

@ -209,7 +209,7 @@ class TestMFARules(test_v3.RestfulTestCase, testcase.TestCase):
class TestAuthInfo(common_auth.AuthTestMixin, testcase.TestCase):
def setUp(self):
super(TestAuthInfo, self).setUp()
auth.controllers.load_auth_methods()
auth.core.load_auth_methods()
def test_unsupported_auth_method(self):
auth_data = {'methods': ['abc']}