summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2021-01-21 13:20:58 +0000
committerGitHub <noreply@github.com>2021-01-21 13:20:58 +0000
commit42a8e81370855a2c612f2acfd1c0648329a12aff (patch)
tree3066fcd35d08e4e93cf2a30b731e3c34d7cc1a84
parentMerge remote-tracking branch 'origin/release-v1.26.0' into develop (diff)
downloadsynapse-42a8e81370855a2c612f2acfd1c0648329a12aff.tar.xz
Add a check for duplicate IdP ids (#9184)
-rw-r--r--changelog.d/9184.misc1
-rw-r--r--synapse/config/oidc_config.py11
2 files changed, 12 insertions, 0 deletions
diff --git a/changelog.d/9184.misc b/changelog.d/9184.misc
new file mode 100644

index 0000000000..70da3d6cf5 --- /dev/null +++ b/changelog.d/9184.misc
@@ -0,0 +1 @@ +Emit an error at startup if different Identity Providers are configured with the same `idp_id`. diff --git a/synapse/config/oidc_config.py b/synapse/config/oidc_config.py
index d58a83be7f..bfeceeed18 100644 --- a/synapse/config/oidc_config.py +++ b/synapse/config/oidc_config.py
@@ -15,6 +15,7 @@ # limitations under the License. import string +from collections import Counter from typing import Iterable, Optional, Tuple, Type import attr @@ -43,6 +44,16 @@ class OIDCConfig(Config): except DependencyException as e: raise ConfigError(e.message) from e + # check we don't have any duplicate idp_ids now. (The SSO handler will also + # check for duplicates when the REST listeners get registered, but that happens + # after synapse has forked so doesn't give nice errors.) + c = Counter([i.idp_id for i in self.oidc_providers]) + for idp_id, count in c.items(): + if count > 1: + raise ConfigError( + "Multiple OIDC providers have the idp_id %r." % idp_id + ) + public_baseurl = self.public_baseurl self.oidc_callback_url = public_baseurl + "_synapse/oidc/callback"