[fix] Automatically reconnect LDAP authenticator when slapd restarts (#185)

* Fix LDAP authenticator when slapd was restarted
* Update parameter for LDAP reconnection
This commit is contained in:
Josue-T 2018-12-13 15:58:00 +01:00 committed by Alexandre Aubin
parent 9a8b5c080a
commit a3436d1146

View file

@ -76,7 +76,7 @@ class Authenticator(BaseAuthenticator):
def authenticate(self, password): def authenticate(self, password):
try: try:
con = ldap.initialize(self.uri) con = ldap.ldapobject.ReconnectLDAPObject(self.uri, retry_max=10, retry_delay=0.5)
if self.userdn: if self.userdn:
con.simple_bind_s(self.userdn, password) con.simple_bind_s(self.userdn, password)
else: else: