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

Commit 42a8e81

Browse files
authored
Add a check for duplicate IdP ids (#9184)
1 parent b5120f0 commit 42a8e81

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

changelog.d/9184.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Emit an error at startup if different Identity Providers are configured with the same `idp_id`.

synapse/config/oidc_config.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# limitations under the License.
1616

1717
import string
18+
from collections import Counter
1819
from typing import Iterable, Optional, Tuple, Type
1920

2021
import attr
@@ -43,6 +44,16 @@ def read_config(self, config, **kwargs):
4344
except DependencyException as e:
4445
raise ConfigError(e.message) from e
4546

47+
# check we don't have any duplicate idp_ids now. (The SSO handler will also
48+
# check for duplicates when the REST listeners get registered, but that happens
49+
# after synapse has forked so doesn't give nice errors.)
50+
c = Counter([i.idp_id for i in self.oidc_providers])
51+
for idp_id, count in c.items():
52+
if count > 1:
53+
raise ConfigError(
54+
"Multiple OIDC providers have the idp_id %r." % idp_id
55+
)
56+
4657
public_baseurl = self.public_baseurl
4758
self.oidc_callback_url = public_baseurl + "_synapse/oidc/callback"
4859

0 commit comments

Comments
 (0)