diff options
author | Azrenbeth <7782548+Azrenbeth@users.noreply.github.com> | 2021-08-25 10:48:47 +0100 |
---|---|---|
committer | Azrenbeth <7782548+Azrenbeth@users.noreply.github.com> | 2021-08-25 10:48:47 +0100 |
commit | 08d386a37a9dee73f2f7301f9c59a77acf487413 (patch) | |
tree | c6a1adc33092e54d29b36c66f0abd1fedf0e2390 | |
parent | Don't import saml stuff if saml not enabled (diff) | |
download | synapse-08d386a37a9dee73f2f7301f9c59a77acf487413.tar.xz |
no longer assert default was loaded, and better test for if using default
-rw-r--r-- | synapse/handlers/saml.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/handlers/saml.py b/synapse/handlers/saml.py index d21d0b327f..9fe33dfd8e 100644 --- a/synapse/handlers/saml.py +++ b/synapse/handlers/saml.py @@ -65,7 +65,9 @@ class SamlHandler(BaseHandler): # At this point either a module will have registered user mapping provider # callbacks or the default will have been registered. - assert self._user_mapping_provider.module_has_registered + # however if for some reason that hasn't happened (e.g. testing) load the default + if not self._user_mapping_provider.module_has_registered: + load_default_or_legacy_saml2_mapping_provider(hs) # Merge the required and optional saml_attributes registered by the mapping # provider with the base sp config. NOTE: If there are conflicts then the @@ -549,7 +551,7 @@ def load_default_or_legacy_saml2_mapping_provider(hs: "HomeServer"): # if we were loading the default provider, then it has already registered its callbacks! # so we can stop here - if module == DEFAULT_USER_MAPPING_PROVIDER: + if module.__module__ + "." + module.__qualname__ == DEFAULT_USER_MAPPING_PROVIDER: return # The required hooks. If a custom module doesn't implement all of these then raise an error |