1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/app/_base.py b/synapse/app/_base.py
index 39e28aff9f..4299327501 100644
--- a/synapse/app/_base.py
+++ b/synapse/app/_base.py
@@ -40,6 +40,7 @@ from synapse.crypto import context_factory
from synapse.events.presence_router import load_legacy_presence_router
from synapse.events.spamcheck import load_legacy_spam_checkers
from synapse.events.third_party_rules import load_legacy_third_party_event_rules
+from synapse.handlers.saml import load_default_or_legacy_saml2_mapping_provider
from synapse.logging.context import PreserveLoggingContext
from synapse.metrics.background_process_metrics import wrap_as_background_process
from synapse.metrics.jemalloc import setup_jemalloc_stats
@@ -372,6 +373,11 @@ async def start(hs: "HomeServer"):
load_legacy_spam_checkers(hs)
load_legacy_third_party_event_rules(hs)
load_legacy_presence_router(hs)
+ # 'module_has_registered' is true if a module calls 'register_saml2_user_mapping_provider_callbacks'
+ # Only one mapping provider can be set, so only load default (or legacy configured one) if this is
+ # still false
+ if not hs.get_saml2_user_mapping_provider().module_has_registered:
+ load_default_or_legacy_saml2_mapping_provider(hs)
# If we've configured an expiry time for caches, start the background job now.
setup_expire_lru_cache_entries(hs)
|