Hopefully, fix NameID parsing

master
Richard van der Hoff 5 years ago
parent b4f2957f93
commit 171ec41069

@ -60,7 +60,11 @@ class SamlMappingProvider(object):
): ):
"""Extracts the remote user id from the SAML response""" """Extracts the remote user id from the SAML response"""
if self._config.use_name_id_for_remote_uid: if self._config.use_name_id_for_remote_uid:
return saml_response.name_id name_id = saml_response.name_id
if not name_id:
logger.warning("SAML2 response lacks a NameID field")
raise CodeMessageException(400, "'NameID' not in SAML2 response")
return name_id.text
else: else:
try: try:
return saml_response.ava["uid"][0] return saml_response.ava["uid"][0]

Loading…
Cancel
Save