Skip to content
Permalink
Browse files

Fix issue #6

  • Loading branch information...
jkolo committed Dec 2, 2016
1 parent 8e75be0 commit 4b07b20b1135bdf7709debf3899ed077fd43ecda
Showing with 7 additions and 6 deletions.
  1. +7 −6 ldap_auth_provider.py
@@ -302,6 +302,7 @@ def _ldap_simple_bind(self, server, bind_dn, password):
logger.warning("Error during LDAP authentication: %s", e)
defer.returnValue((False, None))

@defer.inlineCallbacks
def _ldap_authenticated_search(self, server, localpart, password):
""" Attempt to login with the preconfigured bind_dn
and then continue searching and filtering within
@@ -376,11 +377,11 @@ def _ldap_authenticated_search(self, server, localpart, password):
# Note: do not use rebind(), for some reason it did not verify
# the password for me!
yield threads.deferToThread(conn.unbind)
defer.returnValue(
self._ldap_simple_bind(
server=server, bind_dn=user_dn, passowrd=password
)
result = yield self._ldap_simple_bind(
server=server, bind_dn=user_dn, password=password
)

defer.returnValue(result)
else:
# BAD: found 0 or > 1 results, abort!
if len(conn.response) == 0:
@@ -394,11 +395,11 @@ def _ldap_authenticated_search(self, server, localpart, password):
len(conn.response), localpart
)
yield threads.deferToThread(conn.unbind)
defer.returnValue(False, None)
defer.returnValue((False, None))

except ldap3.core.exceptions.LDAPException as e:
logger.warning("Error during LDAP authentication: %s", e)
defer.returnValue(False, None)
defer.returnValue((False, None))


def _require_keys(config, required):

0 comments on commit 4b07b20

Please sign in to comment.
You can’t perform that action at this time.