diff --git a/src/satosa/base.py b/src/satosa/base.py index 40af1997..196980b7 100644 --- a/src/satosa/base.py +++ b/src/satosa/base.py @@ -151,10 +151,10 @@ def _auth_resp_callback_func(self, context, internal_response): # If configured construct the user id from attribute values. if "user_id_from_attrs" in self.config["INTERNAL_ATTRIBUTES"]: - subject_id = [ - "".join(internal_response.attributes[attr]) for attr in - self.config["INTERNAL_ATTRIBUTES"]["user_id_from_attrs"] - ] + subject_id = [] + for attr in self.config["INTERNAL_ATTRIBUTES"]["user_id_from_attrs"]: + if attr in internal_response.attributes: + subject_id.append("".join(internal_response.attributes[attr])) internal_response.subject_id = "".join(subject_id) if self.response_micro_services: