1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 01:14:21 +01:00

fix authentification for AD backend

This commit is contained in:
kakwa 2015-07-29 00:22:25 +02:00
parent ff08e09598
commit 383c68f8b8

View File

@ -177,3 +177,18 @@ class Backend(ldapcherry.backend.backendLdap.Backend):
for entry in groups:
ret.append(entry[1]['cn'][0])
return ret
def auth(self, username, password):
binddn = username + '@' + self.domain
if binddn is not None:
ldap_client = self._connect()
try:
ldap_client.simple_bind_s(binddn, password)
except ldap.INVALID_CREDENTIALS:
ldap_client.unbind_s()
return False
ldap_client.unbind_s()
return True
else:
return False