From 1306c8b0e1d9b1413bfcb03e398ac6b31509d942 Mon Sep 17 00:00:00 2001 From: Adam Young Date: Fri, 9 Sep 2016 23:27:26 -0400 Subject: [PATCH] Fix parameters for Kerberos Auth Plugin The auth plugin was not loading when called from the CLI due to the mismatch of variable argument parameter calling convention. This was due in part to not specfying the parameters properly in the plugin, and also due to extending from the wrong base class. Closes-Bug: #1622079 Change-Id: I37a8320b61e7468c173f81348b0a7dd0ee1ad966 --- keystoneauth1/extras/kerberos/__init__.py | 6 ++++-- keystoneauth1/extras/kerberos/_loading.py | 2 +- .../unit/extras/kerberos/test_fedkerb_loading.py | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/keystoneauth1/extras/kerberos/__init__.py b/keystoneauth1/extras/kerberos/__init__.py index 1092910c..6ae3ebde 100644 --- a/keystoneauth1/extras/kerberos/__init__.py +++ b/keystoneauth1/extras/kerberos/__init__.py @@ -75,9 +75,11 @@ class MappedKerberos(federation.FederationBaseAuth): use the standard keystone auth process to scope that to any given project. """ - def __init__(self, *args, **kwargs): + def __init__(self, auth_url, identity_provider, protocol, **kwargs): _dependency_check() - super(MappedKerberos, self).__init__(*args, **kwargs) + + super(MappedKerberos, self).__init__(auth_url, identity_provider, + protocol, **kwargs) def get_unscoped_auth_ref(self, session, **kwargs): resp = session.get(self.federated_token_url, diff --git a/keystoneauth1/extras/kerberos/_loading.py b/keystoneauth1/extras/kerberos/_loading.py index 797a18a6..6925ad8e 100644 --- a/keystoneauth1/extras/kerberos/_loading.py +++ b/keystoneauth1/extras/kerberos/_loading.py @@ -25,7 +25,7 @@ class Kerberos(loading.BaseV3Loader): return kerberos.requests_kerberos is not None -class MappedKerberos(loading.BaseV3Loader): +class MappedKerberos(loading.BaseFederationLoader): @property def plugin_class(self): diff --git a/keystoneauth1/tests/unit/extras/kerberos/test_fedkerb_loading.py b/keystoneauth1/tests/unit/extras/kerberos/test_fedkerb_loading.py index 2b189fcc..874543c8 100644 --- a/keystoneauth1/tests/unit/extras/kerberos/test_fedkerb_loading.py +++ b/keystoneauth1/tests/unit/extras/kerberos/test_fedkerb_loading.py @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. +from keystoneauth1 import exceptions from keystoneauth1 import loading from keystoneauth1.tests.unit import utils as test_utils @@ -22,12 +23,26 @@ class FedKerbLoadingTests(test_utils.TestCase): allowed_opts = ['domain-id', 'domain-name', + 'identity-provider', 'project-id', 'project-name', 'project-domain-id', 'project-domain-name', + 'protocol', 'trust-id', 'auth-url', ] self.assertItemsEqual(allowed_opts, opts) + + def create(self, **kwargs): + loader = loading.get_plugin_loader('v3fedkerb') + return loader.load_from_options(**kwargs) + + def test_load_none(self): + self.assertRaises(exceptions.MissingRequiredOptions, self.create) + + def test_load(self): + self.create(auth_url='auth_url', + identity_provider='idp', + protocol='protocol')