diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-12-02 07:45:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-02 07:45:42 -0500 |
commit | 8388384a640d3381b5858d3fb1d2ea0a8c9c059c (patch) | |
tree | 1c1471ce836806d18d71579aa32aae6a9a4a7ce4 /synapse/handlers/saml_handler.py | |
parent | Add basic SAML tests for mapping users. (#8800) (diff) | |
download | synapse-8388384a640d3381b5858d3fb1d2ea0a8c9c059c.tar.xz |
Fix a regression when grandfathering SAML users. (#8855)
This was broken in #8801 when abstracting code shared with OIDC. After this change both SAML and OIDC have a concept of grandfathering users, but with different implementations.
Diffstat (limited to 'synapse/handlers/saml_handler.py')
-rw-r--r-- | synapse/handlers/saml_handler.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/handlers/saml_handler.py b/synapse/handlers/saml_handler.py index 7ffad7d8af..76d4169fe2 100644 --- a/synapse/handlers/saml_handler.py +++ b/synapse/handlers/saml_handler.py @@ -268,7 +268,7 @@ class SamlHandler(BaseHandler): 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): |