mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 20:23:52 +01:00
conditionally import ldap
This commit is contained in:
parent
875ed05bdc
commit
4c5e8adf8b
2 changed files with 5 additions and 3 deletions
|
@ -30,8 +30,6 @@ import simplejson
|
||||||
|
|
||||||
import synapse.util.stringutils as stringutils
|
import synapse.util.stringutils as stringutils
|
||||||
|
|
||||||
import ldap
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -60,6 +58,9 @@ class AuthHandler(BaseHandler):
|
||||||
self.ldap_email_property = hs.config.ldap_email_property
|
self.ldap_email_property = hs.config.ldap_email_property
|
||||||
self.ldap_full_name_property = hs.config.ldap_full_name_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?
|
self.hs = hs # FIXME better possibility to access registrationHandler later?
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -445,6 +446,8 @@ class AuthHandler(BaseHandler):
|
||||||
logger.info("LDAP not configured")
|
logger.info("LDAP not configured")
|
||||||
defer.returnValue(False)
|
defer.returnValue(False)
|
||||||
|
|
||||||
|
import ldap
|
||||||
|
|
||||||
logger.info("Authenticating %s with LDAP" % user_id)
|
logger.info("Authenticating %s with LDAP" % user_id)
|
||||||
try:
|
try:
|
||||||
ldap_url = "%s:%s" % (self.ldap_server, self.ldap_port)
|
ldap_url = "%s:%s" % (self.ldap_server, self.ldap_port)
|
||||||
|
|
|
@ -37,7 +37,6 @@ REQUIREMENTS = {
|
||||||
"pysaml2>=3.0.0,<4.0.0": ["saml2>=3.0.0,<4.0.0"],
|
"pysaml2>=3.0.0,<4.0.0": ["saml2>=3.0.0,<4.0.0"],
|
||||||
"pymacaroons-pynacl": ["pymacaroons"],
|
"pymacaroons-pynacl": ["pymacaroons"],
|
||||||
"pyjwt": ["jwt"],
|
"pyjwt": ["jwt"],
|
||||||
"python-ldap": ["ldap"],
|
|
||||||
}
|
}
|
||||||
CONDITIONAL_REQUIREMENTS = {
|
CONDITIONAL_REQUIREMENTS = {
|
||||||
"web_client": {
|
"web_client": {
|
||||||
|
|
Loading…
Reference in a new issue