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

Commit accef11

Browse files
AzrenbethAzrenbeth
authored andcommitted
Removed the old module style from sample_config
1 parent 58d87e9 commit accef11

File tree

3 files changed

+25
-58
lines changed

3 files changed

+25
-58
lines changed

docs/sample_config.yaml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,34 +2407,6 @@ email:
24072407
#email_validation: "[%(server_name)s] Validate your email"
24082408

24092409

2410-
# Password providers allow homeserver administrators to integrate
2411-
# their Synapse installation with existing authentication methods
2412-
# ex. LDAP, external tokens, etc.
2413-
#
2414-
# For more information and known implementations, please see
2415-
# https://matrix-org.github.io/synapse/latest/password_auth_providers.html
2416-
#
2417-
# Note: instances wishing to use SAML or CAS authentication should
2418-
# instead use the `saml2_config` or `cas_config` options,
2419-
# respectively.
2420-
#
2421-
password_providers:
2422-
# # Example config for an LDAP auth provider
2423-
# - module: "ldap_auth_provider.LdapAuthProvider"
2424-
# config:
2425-
# enabled: true
2426-
# uri: "ldap://ldap.example.com:389"
2427-
# start_tls: true
2428-
# base: "ou=users,dc=example,dc=com"
2429-
# attributes:
2430-
# uid: "cn"
2431-
# mail: "email"
2432-
# name: "givenName"
2433-
# #bind_dn:
2434-
# #bind_password:
2435-
# #filter: "(objectClass=posixAccount)"
2436-
2437-
24382410

24392411
## Push ##
24402412

synapse/config/password_auth_providers.py

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,29 @@ class PasswordAuthProviderConfig(Config):
2525
section = "authproviders"
2626

2727
def read_config(self, config, **kwargs):
28+
"""Parses the old account validity config. The config format looks like this:
29+
30+
password_providers:
31+
# Example config for an LDAP auth provider
32+
- module: "ldap_auth_provider.LdapAuthProvider"
33+
config:
34+
enabled: true
35+
uri: "ldap://ldap.example.com:389"
36+
start_tls: true
37+
base: "ou=users,dc=example,dc=com"
38+
attributes:
39+
uid: "cn"
40+
mail: "email"
41+
name: "givenName"
42+
#bind_dn:
43+
#bind_password:
44+
#filter: "(objectClass=posixAccount)"
45+
46+
We expect admins to use modules for this feature (which is why it doesn't appear
47+
in the sample config file), but we want to keep support for it around for a bit
48+
for backwards compatibility.
49+
"""
50+
2851
self.password_providers: List[Any] = []
2952
providers = []
3053

@@ -49,33 +72,3 @@ def read_config(self, config, **kwargs):
4972
)
5073

5174
self.password_providers.append((provider_class, provider_config))
52-
53-
def generate_config_section(self, **kwargs):
54-
return """\
55-
# Password providers allow homeserver administrators to integrate
56-
# their Synapse installation with existing authentication methods
57-
# ex. LDAP, external tokens, etc.
58-
#
59-
# For more information and known implementations, please see
60-
# https://matrix-org.github.io/synapse/latest/password_auth_providers.html
61-
#
62-
# Note: instances wishing to use SAML or CAS authentication should
63-
# instead use the `saml2_config` or `cas_config` options,
64-
# respectively.
65-
#
66-
password_providers:
67-
# # Example config for an LDAP auth provider
68-
# - module: "ldap_auth_provider.LdapAuthProvider"
69-
# config:
70-
# enabled: true
71-
# uri: "ldap://ldap.example.com:389"
72-
# start_tls: true
73-
# base: "ou=users,dc=example,dc=com"
74-
# attributes:
75-
# uid: "cn"
76-
# mail: "email"
77-
# name: "givenName"
78-
# #bind_dn:
79-
# #bind_password:
80-
# #filter: "(objectClass=posixAccount)"
81-
"""

synapse/storage/prepare_database.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,8 @@ def _apply_module_schemas(
545545
database_engine:
546546
config: application config
547547
"""
548+
# This is the old way for password_auth_provider modules to make changes
549+
# to the database. This should instead be done using the module API
548550
for (mod, _config) in config.password_providers:
549551
if not hasattr(mod, "get_db_schema_files"):
550552
continue

0 commit comments

Comments
 (0)