Allow use of user-id as well as username for authentication
Story: 2004898 Task: 29210 Change-Id: I33424f75e8624b84cdee01fea004a9bf0c7e5edb Depends-On: https://review.openstack.org/#/c/634776/
This commit is contained in:
parent
aaf18dad8d
commit
023779311b
@ -106,10 +106,13 @@ def check_valid_authentication_options(options, auth_plugin_name):
|
||||
'Set a cloud-name with --os-cloud or OS_CLOUD'
|
||||
))
|
||||
else:
|
||||
if 'password' in plugin_opts and not options.auth.get('username'):
|
||||
if ('password' in plugin_opts and not
|
||||
(options.auth.get('username') or options.auth.get('user_id'))):
|
||||
msgs.append(_(
|
||||
'Set a username with --os-username, OS_USERNAME,'
|
||||
' or auth.username'
|
||||
' or set a user-id with --os-user-id, OS_USER_ID,'
|
||||
' or auth.user_id'
|
||||
))
|
||||
if 'auth_url' in plugin_opts and not options.auth.get('auth_url'):
|
||||
msgs.append(_(
|
||||
|
@ -32,10 +32,12 @@ class TestOSCConfig(utils.TestCase):
|
||||
def test_auth_select_default_plugin_password(self):
|
||||
config = {
|
||||
'username': 'fred',
|
||||
'user_id': 'fr3d',
|
||||
}
|
||||
ret_config = self.cloud._auth_select_default_plugin(config)
|
||||
self.assertEqual('password', ret_config['auth_type'])
|
||||
self.assertEqual('fred', ret_config['username'])
|
||||
self.assertEqual('fr3d', ret_config['user_id'])
|
||||
|
||||
def test_auth_select_default_plugin_password_v2(self):
|
||||
config = {
|
||||
|
@ -23,6 +23,7 @@ from keystoneauth1 import fixture
|
||||
AUTH_TOKEN = "foobar"
|
||||
AUTH_URL = "http://0.0.0.0"
|
||||
USERNAME = "itchy"
|
||||
USER_ID = "2354b7c1-f681-4c39-8003-4fe9d1eabb65"
|
||||
PASSWORD = "scratchy"
|
||||
PROJECT_NAME = "poochie"
|
||||
PROJECT_ID = "30c3da29-61f5-4b7b-8eb2-3d18287428c7"
|
||||
|
@ -302,6 +302,16 @@ class TestClientManager(utils.TestClientManager):
|
||||
identity_api_version='3',
|
||||
)
|
||||
|
||||
auth_args = copy.deepcopy(self.default_password_auth)
|
||||
auth_args.pop('username')
|
||||
auth_args.update({
|
||||
'user_id': fakes.USER_ID,
|
||||
})
|
||||
self._make_clientmanager(
|
||||
auth_args=auth_args,
|
||||
identity_api_version='3',
|
||||
)
|
||||
|
||||
def test_client_manager_select_auth_plugin_token(self):
|
||||
# test token auth
|
||||
self._make_clientmanager(
|
||||
|
Loading…
x
Reference in New Issue
Block a user