diff options
author | Christoph Witzany <christoph@web.crofting.com> | 2016-04-06 17:56:12 +0200 |
---|---|---|
committer | Christoph Witzany <christoph@web.crofting.com> | 2016-04-06 18:23:46 +0200 |
commit | 4c5e8adf8b326798ec71a1cc1caac49f63980ba8 (patch) | |
tree | 42a859df49c78acfb801475ea330552d79bce1b3 /synapse/handlers | |
parent | fix pep8 (diff) | |
download | synapse-4c5e8adf8b326798ec71a1cc1caac49f63980ba8.tar.xz |
conditionally import ldap
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/auth.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py index ee2b285cc1..12585abb1b 100644 --- a/synapse/handlers/auth.py +++ b/synapse/handlers/auth.py @@ -30,8 +30,6 @@ import simplejson import synapse.util.stringutils as stringutils -import ldap - logger = logging.getLogger(__name__) @@ -60,6 +58,9 @@ class AuthHandler(BaseHandler): self.ldap_email_property = hs.config.ldap_email_property self.ldap_full_name_property = hs.config.ldap_full_name_property + if self.ldap_enabled: + import ldap + self.hs = hs # FIXME better possibility to access registrationHandler later? @defer.inlineCallbacks @@ -445,6 +446,8 @@ class AuthHandler(BaseHandler): logger.info("LDAP not configured") defer.returnValue(False) + import ldap + logger.info("Authenticating %s with LDAP" % user_id) try: ldap_url = "%s:%s" % (self.ldap_server, self.ldap_port) |