1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

fix a bug when Tower is integrated with ipsilon SAML server

https://github.com/ansible/ansible-tower/issues/6683
This commit is contained in:
Ryan Petrello 2017-06-26 15:07:23 -04:00 committed by Matthew Jones
parent 4f4af058b3
commit b372cebf8d

View File

@ -240,7 +240,10 @@ class TowerSAMLIdentityProvider(BaseSAMLIdentityProvider):
another attribute to use.
"""
key = self.conf.get(conf_key, default_attribute)
value = attributes[key][0] if key in attributes else None
value = attributes[key] if key in attributes else None
# In certain implementations (like https://pagure.io/ipsilon) this value is a string, not a list
if isinstance(value, (list, tuple)):
value = value[0]
if conf_key in ('attr_first_name', 'attr_last_name', 'attr_username', 'attr_email') and value is None:
logger.warn("Could not map user detail '%s' from SAML attribute '%s'; "
"update SOCIAL_AUTH_SAML_ENABLED_IDPS['%s']['%s'] with the correct SAML attribute.",