diff --git a/keystoneauth1/extras/_saml2/__init__.py b/keystoneauth1/extras/_saml2/__init__.py index 26ba6cf4..a15d1f9e 100644 --- a/keystoneauth1/extras/_saml2/__init__.py +++ b/keystoneauth1/extras/_saml2/__init__.py @@ -13,6 +13,7 @@ from keystoneauth1.extras._saml2 import v3 _V3_SAML2_AVAILABLE = v3._SAML2_AVAILABLE +_V3_ADFS_AVAILABLE = v3._ADFS_AVAILABLE V3Saml2Password = v3.Saml2Password V3ADFSPassword = v3.ADFSPassword diff --git a/keystoneauth1/extras/_saml2/_loading.py b/keystoneauth1/extras/_saml2/_loading.py index d3cf3456..8d01ce23 100644 --- a/keystoneauth1/extras/_saml2/_loading.py +++ b/keystoneauth1/extras/_saml2/_loading.py @@ -44,6 +44,10 @@ class ADFSPassword(loading.BaseFederationLoader): def plugin_class(self): return _saml2.V3ADFSPassword + @property + def available(self): + return _saml2._V3_ADFS_AVAILABLE + def get_options(self): options = super(ADFSPassword, self).get_options() diff --git a/keystoneauth1/extras/_saml2/v3/__init__.py b/keystoneauth1/extras/_saml2/v3/__init__.py index 3745946a..4dbbeff6 100644 --- a/keystoneauth1/extras/_saml2/v3/__init__.py +++ b/keystoneauth1/extras/_saml2/v3/__init__.py @@ -11,9 +11,11 @@ # under the License. from keystoneauth1.extras._saml2.v3 import adfs +from keystoneauth1.extras._saml2.v3 import base from keystoneauth1.extras._saml2.v3 import saml2 -_SAML2_AVAILABLE = saml2.etree is not None +_SAML2_AVAILABLE = base.etree is not None and saml2.etree is not None +_ADFS_AVAILABLE = base.etree is not None and adfs.etree is not None Saml2Password = saml2.Password ADFSPassword = adfs.Password diff --git a/keystoneauth1/extras/_saml2/v3/adfs.py b/keystoneauth1/extras/_saml2/v3/adfs.py index ab2b9166..ce68588a 100644 --- a/keystoneauth1/extras/_saml2/v3/adfs.py +++ b/keystoneauth1/extras/_saml2/v3/adfs.py @@ -13,7 +13,11 @@ import datetime import uuid -from lxml import etree +try: + from lxml import etree +except ImportError: + etree = None + from six.moves import urllib from keystoneauth1 import access diff --git a/keystoneauth1/extras/_saml2/v3/base.py b/keystoneauth1/extras/_saml2/v3/base.py index cdb1bc76..d221d158 100644 --- a/keystoneauth1/extras/_saml2/v3/base.py +++ b/keystoneauth1/extras/_saml2/v3/base.py @@ -10,7 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. -from lxml import etree +try: + from lxml import etree +except ImportError: + etree = None from keystoneauth1 import exceptions from keystoneauth1.identity import v3