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
This commit is contained in:
Adam Young 2016-09-09 23:27:26 -04:00 committed by Steve Martinelli
parent c5aeaf6aff
commit 1306c8b0e1
3 changed files with 20 additions and 3 deletions

View File

@ -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,

View File

@ -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):

View File

@ -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')