multiple ldap servers can be defined in ldap_url

This commit is contained in:
holczer 2020-06-15 16:13:37 +02:00
parent a396d8da41
commit b71adb30ec
2 changed files with 4 additions and 1 deletions

View File

@ -8,7 +8,7 @@ You will need to set a few options inside your radicale config file. Example:
[auth]
type = radicale_auth_ldap
# LDAP server URL, with protocol and port
# LDAP server URL, with protocol and port (multiple servers can be separated by spaces)
ldap_url = ldap://ldap:389
# LDAP base path

View File

@ -46,6 +46,9 @@ class Auth(BaseAuth):
SCOPE = self.configuration.get("auth", "ldap_scope")
SUPPORT_EXTENDED = self.configuration.getboolean("auth", "ldap_support_extended", fallback=True)
if ' ' in SERVER: # Handle if multiple LDAP server is defined in ldap_url with space separation
SERVER = SERVER.split(' ') # ldap3.connection can handle multiple servers in a list as an implicit server pool
if BINDDN and PASSWORD:
conn = ldap3.Connection(SERVER, BINDDN, PASSWORD)
else: