summary refs log tree commit diff
path: root/synapse/handlers/saml_handler.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-12-31 17:19:48 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-12-31 17:19:48 +0000
commitb0c601e00e7f8d7e171947e93bb1d6d32e6d58f5 (patch)
tree24b7b8c4f55e29f0b8ba6903e34c23eacb0f072d /synapse/handlers/saml_handler.py
parentMerge commit 'd3ed93504' into anoa/dinsic_release_1_23_1 (diff)
parent1.24.0rc1 (diff)
downloadsynapse-b0c601e00e7f8d7e171947e93bb1d6d32e6d58f5.tar.xz
Merge commit '53b12688d' into anoa/dinsic_release_1_23_1
Diffstat (limited to 'synapse/handlers/saml_handler.py')
-rw-r--r--synapse/handlers/saml_handler.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/synapse/handlers/saml_handler.py b/synapse/handlers/saml_handler.py

index 34db10ffe4..76d4169fe2 100644 --- a/synapse/handlers/saml_handler.py +++ b/synapse/handlers/saml_handler.py
@@ -265,10 +265,10 @@ class SamlHandler(BaseHandler): return UserAttributes( localpart=result.get("mxid_localpart"), display_name=result.get("displayname"), - emails=result.get("emails"), + emails=result.get("emails", []), ) - with (await self._mapping_lock.queue(self._auth_provider_id)): + async def grandfather_existing_users() -> Optional[str]: # backwards-compatibility hack: see if there is an existing user with a # suitable mapping from the uid if ( @@ -290,17 +290,18 @@ class SamlHandler(BaseHandler): if users: registered_user_id = list(users.keys())[0] logger.info("Grandfathering mapping to %s", registered_user_id) - await self.store.record_user_external_id( - self._auth_provider_id, remote_user_id, registered_user_id - ) return registered_user_id + return None + + with (await self._mapping_lock.queue(self._auth_provider_id)): return await self._sso_handler.get_mxid_from_sso( self._auth_provider_id, remote_user_id, user_agent, ip_address, saml_response_to_remapped_user_attributes, + grandfather_existing_users, ) def expire_sessions(self):