mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-16 15:01:23 +01:00
Improve logging of the mapping from SSO IDs to Matrix IDs. (#8773)
This commit is contained in:
parent
8ca120df7c
commit
59a995f38d
3 changed files with 13 additions and 5 deletions
1
changelog.d/8773.misc
Normal file
1
changelog.d/8773.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Minor log line improvements for the SSO mapping code used to generate Matrix IDs from SSO IDs.
|
|
@ -268,7 +268,8 @@ class SamlHandler(BaseHandler):
|
||||||
user_id = UserID(
|
user_id = UserID(
|
||||||
map_username_to_mxid_localpart(attrval), self.server_name
|
map_username_to_mxid_localpart(attrval), self.server_name
|
||||||
).to_string()
|
).to_string()
|
||||||
logger.info(
|
|
||||||
|
logger.debug(
|
||||||
"Looking for existing account based on mapped %s %s",
|
"Looking for existing account based on mapped %s %s",
|
||||||
self._grandfathered_mxid_source_attribute,
|
self._grandfathered_mxid_source_attribute,
|
||||||
user_id,
|
user_id,
|
||||||
|
@ -324,7 +325,7 @@ class SamlHandler(BaseHandler):
|
||||||
if contains_invalid_mxid_characters(localpart):
|
if contains_invalid_mxid_characters(localpart):
|
||||||
raise MappingException("localpart is invalid: %s" % (localpart,))
|
raise MappingException("localpart is invalid: %s" % (localpart,))
|
||||||
|
|
||||||
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(
|
registered_user_id = await self._registration_handler.register_user(
|
||||||
localpart=localpart,
|
localpart=localpart,
|
||||||
default_display_name=displayname,
|
default_display_name=displayname,
|
||||||
|
|
|
@ -71,19 +71,25 @@ class SsoHandler(BaseHandler):
|
||||||
Returns:
|
Returns:
|
||||||
The mxid of a previously seen user.
|
The mxid of a previously seen user.
|
||||||
"""
|
"""
|
||||||
# Check if we already have a mapping for this user.
|
logger.debug(
|
||||||
logger.info(
|
|
||||||
"Looking for existing mapping for user %s:%s",
|
"Looking for existing mapping for user %s:%s",
|
||||||
auth_provider_id,
|
auth_provider_id,
|
||||||
remote_user_id,
|
remote_user_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Check if we already have a mapping for this user.
|
||||||
previously_registered_user_id = await self.store.get_user_by_external_id(
|
previously_registered_user_id = await self.store.get_user_by_external_id(
|
||||||
auth_provider_id, remote_user_id,
|
auth_provider_id, remote_user_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# A match was found, return the user ID.
|
# A match was found, return the user ID.
|
||||||
if previously_registered_user_id is not None:
|
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
|
return previously_registered_user_id
|
||||||
|
|
||||||
# No match.
|
# No match.
|
||||||
|
|
Loading…
Reference in a new issue