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

Only log if an existing localpart was found, extend logged info #8773

Merged
merged 5 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
1 change: 1 addition & 0 deletions changelog.d/8773.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Minor log line reductions for the SSO mapping code.
clokep marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 1 addition & 6 deletions synapse/handlers/saml_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,6 @@ async def _map_saml_response_to_user(
user_id = UserID(
map_username_to_mxid_localpart(attrval), self.server_name
).to_string()
logger.info(
"Looking for existing account based on mapped %s %s",
self._grandfathered_mxid_source_attribute,
user_id,
)
anoadragon453 marked this conversation as resolved.
Show resolved Hide resolved

users = await self.store.get_users_by_id_case_insensitive(user_id)
if users:
Expand Down Expand Up @@ -317,7 +312,7 @@ async def _map_saml_response_to_user(
"Unable to generate a Matrix ID from the SAML response"
)

logger.info("Mapped SAML user to local part %s", localpart)
logger.debug("Mapped SAML user to local part %s", localpart)
registered_user_id = await self._registration_handler.register_user(
localpart=localpart,
default_display_name=displayname,
Expand Down
12 changes: 6 additions & 6 deletions synapse/handlers/sso.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ async def get_sso_user_by_remote_user_id(
The mxid of a previously seen user.
"""
# Check if we already have a mapping for this user.
logger.info(
clokep marked this conversation as resolved.
Show resolved Hide resolved
"Looking for existing mapping for user %s:%s",
auth_provider_id,
remote_user_id,
)
previously_registered_user_id = await self.store.get_user_by_external_id(
auth_provider_id, remote_user_id,
)

# A match was found, return the user ID.
if previously_registered_user_id is not None:
logger.info("Found existing mapping %s", previously_registered_user_id)
logger.info(
"Found existing mapping for IdP '%s' and remote_user_id '%s': %s",
auth_provider_id,
remote_user_id,
previously_registered_user_id,
)
return previously_registered_user_id

# No match.
Expand Down