Change auth plugin names to match KSA
The names of the plugins should match KSA and KSC. Change-Id: I2f8633523bd596904f8eeb818c216daa923ace64
This commit is contained in:
@@ -113,7 +113,7 @@ class Connection(object):
|
|||||||
the authentication plugin name is not provided, the connection will
|
the authentication plugin name is not provided, the connection will
|
||||||
try to guess what plugin to use based on the *auth_url* in the
|
try to guess what plugin to use based on the *auth_url* in the
|
||||||
*auth_args*. Two common values for the plugin would be
|
*auth_args*. Two common values for the plugin would be
|
||||||
``identity_v2`` and ``identity_v3``.
|
``v3password`` and ``v3token``.
|
||||||
:param auth_args: The rest of the parameters provided are assumed to be
|
:param auth_args: The rest of the parameters provided are assumed to be
|
||||||
authentication arguments that are used by the authentication
|
authentication arguments that are used by the authentication
|
||||||
plugin.
|
plugin.
|
||||||
|
@@ -30,7 +30,7 @@ class ModuleLoader(object):
|
|||||||
def get_auth_plugin(self, plugin_name):
|
def get_auth_plugin(self, plugin_name):
|
||||||
"""Get an authentication plugin by name."""
|
"""Get an authentication plugin by name."""
|
||||||
if not plugin_name:
|
if not plugin_name:
|
||||||
plugin_name = 'identity'
|
plugin_name = 'password'
|
||||||
try:
|
try:
|
||||||
return self.auth_mgr[plugin_name].plugin
|
return self.auth_mgr[plugin_name].plugin
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@@ -45,7 +45,7 @@ class TestConnection(base.TestCase):
|
|||||||
'password': '2',
|
'password': '2',
|
||||||
}
|
}
|
||||||
conn = connection.Connection(transport='0',
|
conn = connection.Connection(transport='0',
|
||||||
auth_plugin='identity_v2_password',
|
auth_plugin='v2password',
|
||||||
**auth_args)
|
**auth_args)
|
||||||
self.assertEqual('0', conn.authenticator.auth_url)
|
self.assertEqual('0', conn.authenticator.auth_url)
|
||||||
self.assertEqual('1', conn.authenticator.username)
|
self.assertEqual('1', conn.authenticator.username)
|
||||||
@@ -58,7 +58,7 @@ class TestConnection(base.TestCase):
|
|||||||
'password': '2',
|
'password': '2',
|
||||||
}
|
}
|
||||||
conn = connection.Connection(transport='0',
|
conn = connection.Connection(transport='0',
|
||||||
auth_plugin='identity_v3_password',
|
auth_plugin='v3password',
|
||||||
**auth_args)
|
**auth_args)
|
||||||
self.assertEqual('0', conn.authenticator.auth_url)
|
self.assertEqual('0', conn.authenticator.auth_url)
|
||||||
self.assertEqual('1', conn.authenticator.auth_methods[0].username)
|
self.assertEqual('1', conn.authenticator.auth_methods[0].username)
|
||||||
@@ -70,7 +70,7 @@ class TestConnection(base.TestCase):
|
|||||||
'username': '1',
|
'username': '1',
|
||||||
'password': '2',
|
'password': '2',
|
||||||
}
|
}
|
||||||
conn = connection.Connection(transport='0', auth_plugin='identity',
|
conn = connection.Connection(transport='0', auth_plugin='password',
|
||||||
**auth_args)
|
**auth_args)
|
||||||
self.assertEqual('0', conn.authenticator.auth_url)
|
self.assertEqual('0', conn.authenticator.auth_url)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@@ -18,20 +18,20 @@ from openstack.tests.unit import base
|
|||||||
class TestModuleLoader(base.TestCase):
|
class TestModuleLoader(base.TestCase):
|
||||||
def test_load_identity_v2(self):
|
def test_load_identity_v2(self):
|
||||||
loader = module_loader.ModuleLoader()
|
loader = module_loader.ModuleLoader()
|
||||||
plugin = loader.get_auth_plugin('identity_v2_password')
|
plugin = loader.get_auth_plugin('v2password')
|
||||||
self.assertEqual('openstack.auth.identity.v2', str(plugin.__module__))
|
self.assertEqual('openstack.auth.identity.v2', str(plugin.__module__))
|
||||||
plugin = loader.get_auth_plugin('identity_v2_token')
|
plugin = loader.get_auth_plugin('v2token')
|
||||||
self.assertEqual('openstack.auth.identity.v2', str(plugin.__module__))
|
self.assertEqual('openstack.auth.identity.v2', str(plugin.__module__))
|
||||||
|
|
||||||
def test_load_identity_v3(self):
|
def test_load_identity_v3(self):
|
||||||
loader = module_loader.ModuleLoader()
|
loader = module_loader.ModuleLoader()
|
||||||
plugin = loader.get_auth_plugin('identity_v3_password')
|
plugin = loader.get_auth_plugin('v3password')
|
||||||
self.assertEqual('openstack.auth.identity.v3', str(plugin.__module__))
|
self.assertEqual('openstack.auth.identity.v3', str(plugin.__module__))
|
||||||
plugin = loader.get_auth_plugin('identity_v3_token')
|
plugin = loader.get_auth_plugin('v3token')
|
||||||
self.assertEqual('openstack.auth.identity.v3', str(plugin.__module__))
|
self.assertEqual('openstack.auth.identity.v3', str(plugin.__module__))
|
||||||
|
|
||||||
def test_load_identity_discoverable(self):
|
def test_load_identity_discoverable(self):
|
||||||
plugin = module_loader.ModuleLoader().get_auth_plugin('identity')
|
plugin = module_loader.ModuleLoader().get_auth_plugin('password')
|
||||||
self.assertEqual('openstack.auth.identity.discoverable',
|
self.assertEqual('openstack.auth.identity.discoverable',
|
||||||
str(plugin.__module__))
|
str(plugin.__module__))
|
||||||
|
|
||||||
@@ -51,6 +51,6 @@ class TestModuleLoader(base.TestCase):
|
|||||||
|
|
||||||
def test_list_auth_plugins(self):
|
def test_list_auth_plugins(self):
|
||||||
plugins = sorted(module_loader.ModuleLoader().list_auth_plugins())
|
plugins = sorted(module_loader.ModuleLoader().list_auth_plugins())
|
||||||
expected = ['identity', 'identity_v2_password', 'identity_v2_token',
|
expected = ['password', 'token', 'v2password', 'v2token',
|
||||||
'identity_v3_password', 'identity_v3_token']
|
'v3password', 'v3token']
|
||||||
self.assertEqual(expected, plugins)
|
self.assertEqual(expected, plugins)
|
||||||
|
11
setup.cfg
11
setup.cfg
@@ -51,8 +51,9 @@ universal = 1
|
|||||||
|
|
||||||
[entry_points]
|
[entry_points]
|
||||||
openstack.auth.plugin =
|
openstack.auth.plugin =
|
||||||
identity_v2_password = openstack.auth.identity.v2:Password
|
v2password = openstack.auth.identity.v2:Password
|
||||||
identity_v2_token = openstack.auth.identity.v2:Token
|
v2token = openstack.auth.identity.v2:Token
|
||||||
identity_v3_password = openstack.auth.identity.v3:Password
|
v3password = openstack.auth.identity.v3:Password
|
||||||
identity_v3_token = openstack.auth.identity.v3:Token
|
v3token = openstack.auth.identity.v3:Token
|
||||||
identity = openstack.auth.identity.discoverable:Auth
|
password = openstack.auth.identity.discoverable:Auth
|
||||||
|
token = openstack.auth.identity.discoverable:Auth
|
||||||
|
Reference in New Issue
Block a user