mirror of
https://github.com/kakwa/ldapcherry
synced 2025-07-04 20:37:48 +02:00
fix authentification for AD backend
This commit is contained in:
parent
ff08e09598
commit
383c68f8b8
1 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue