Issue #31. Solved bug when no attributes.

Using a default value when CAS give no attributes.
This commit is contained in:
Marta Añón 2016-01-07 18:00:03 +01:00
parent e5b5a9e97e
commit a485e900f1

View file

@ -122,7 +122,7 @@ def validate(ticket):
current_app.logger.debug("valid")
xml_from_dict = xml_from_dict["cas:serviceResponse"]["cas:authenticationSuccess"]
username = xml_from_dict["cas:user"]
attributes = xml_from_dict["cas:attributes"]
attributes = xml_from_dict.get("cas:attributes", {})
if "cas:memberOf" in attributes:
attributes["cas:memberOf"] = attributes["cas:memberOf"].lstrip('[').rstrip(']').split(',')