Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Support trying multiple localparts for OpenID Connect. #8801

Merged
merged 17 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions synapse/handlers/oidc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,12 @@ async def oidc_response_to_user_attributes(failures):
userinfo, token, failures
)
else:
# If the mapping provider does not support processing failures,
# do not continually generate the same Matrix ID since this will
# likely continue to fail.
if failures:
raise RuntimeError("Mapping provider does not support de-duplicating Matrix IDs")
clokep marked this conversation as resolved.
Show resolved Hide resolved

attributes = await self._user_mapping_provider.map_user_attributes( # type: ignore
userinfo, token
)
Expand Down
3 changes: 2 additions & 1 deletion tests/handlers/test_oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,8 @@ def test_map_userinfo_to_user(self):
MappingException,
)
self.assertEqual(
str(e.value), "Unable to generate a Matrix ID from the SSO response"
str(e.value),
"Could not extract user attributes from SSO response: Mapping provider does not support de-duplicating Matrix IDs",
)

@override_config({"oidc_config": {"allow_existing_users": True}})
Expand Down