aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--radicale_auth_ldap/__init__.py14
-rw-r--r--setup.py2
2 files changed, 12 insertions, 4 deletions
diff --git a/radicale_auth_ldap/__init__.py b/radicale_auth_ldap/__init__.py
index 4a3b6dc..6a86c2c 100644
--- a/radicale_auth_ldap/__init__.py
+++ b/radicale_auth_ldap/__init__.py
@@ -39,7 +39,7 @@ PLUGIN_CONFIG_SCHEMA = {
"auth": {
"ldap_url": {
"value": "ldap://localhost:389",
- "help": "LDAP server URL, with protocol and port",
+ "help": "LDAP server URL, with protocol and port (multiple servers can be separated by spaces)",
"type": str
},
"ldap_base": {
@@ -140,8 +140,16 @@ class Auth(BaseAuth):
def login(self, login, password):
"""Check if ``login``/``password`` couple is valid."""
- SERVER = ldap3.Server(self.ldap_url)
-
+ servers = self.configuration.get("auth", "ldap_url")
+ if ' ' in servers: # Handle for multiple LDAP server defined in ldap_url with space separation
+ servers = servers.split(' ')
+ logger.debug("Multiple servers: %s" % servers)
+ SERVER = ldap3.ServerPool(None)
+ for s in servers:
+ SERVER.add(ldap3.Server(s))
+ else: # only one server is defined
+ logger.debug("Single server: %s" % servers)
+ SERVER = ldap3.Server(servers)
if self.ldap_binddn and self.ldap_password:
conn = ldap3.Connection(SERVER, self.ldap_binddn, self.ldap_password)
else:
diff --git a/setup.py b/setup.py
index 965e73c..ce5811f 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ from distutils.core import setup
setup(
name="radicale-auth-ldap",
- version="0.2",
+ version="0.3",
description="LDAP Authentication Plugin for Radicale 3",
author="Raoul Thill",
license="GNU GPL v3",
bgstack15