Add reauthenticate to generic plugins

Currently, the plugins supported in the generic plugins all have a
reathenticate option, however, this is not passed anywhere in the
generic plugin interface. This adds it to the base class in order to
support this, and provide a more interchangeable interface between
the version-specific plugins and the generic one.

Change-Id: I35f1c9dcd20017b9c442b04c142e46cad4d15eb4
Closes-Bug: #1643782
This commit is contained in:
Juan Antonio Osorio Robles 2016-11-22 09:27:11 +02:00
parent b6f8648177
commit 08539ec4d6
2 changed files with 13 additions and 4 deletions

View File

@ -43,8 +43,10 @@ class BaseGenericPlugin(base.BaseIdentityPlugin):
domain_name=None,
trust_id=None,
default_domain_id=None,
default_domain_name=None):
super(BaseGenericPlugin, self).__init__(auth_url=auth_url)
default_domain_name=None,
reauthenticate=True):
super(BaseGenericPlugin, self).__init__(auth_url=auth_url,
reauthenticate=reauthenticate)
self._project_id = project_id or tenant_id
self._project_name = project_name or tenant_name
@ -93,7 +95,8 @@ class BaseGenericPlugin(base.BaseIdentityPlugin):
"""Return the parameters that are common to v2 plugins."""
return {'trust_id': self._trust_id,
'tenant_id': self._project_id,
'tenant_name': self._project_name}
'tenant_name': self._project_name,
'reauthenticate': self.reauthenticate}
@property
def _v3_params(self):
@ -104,7 +107,8 @@ class BaseGenericPlugin(base.BaseIdentityPlugin):
'project_domain_id': self.project_domain_id,
'project_domain_name': self.project_domain_name,
'domain_id': self._domain_id,
'domain_name': self._domain_name}
'domain_name': self._domain_name,
'reauthenticate': self.reauthenticate}
@property
def project_domain_id(self):

View File

@ -93,6 +93,11 @@ class GenericPluginTestCase(utils.TestCase):
self.assertCreateV2(tenant_id=uuid.uuid4().hex)
self.assertCreateV2(tenant_name=uuid.uuid4().hex)
def test_create_plugin_no_reauthenticate(self):
self.stub_discovery()
self.assertCreateV2(reauthenticate=False)
self.assertCreateV3(domain_id=uuid.uuid4().hex, reauthenticate=False)
def test_v3_params_v2_url(self):
self.stub_discovery(v3=False)
self.assertDiscoveryFailure(domain_name=uuid.uuid4().hex)