1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-06-28 11:02:39 +02:00

Fix configuration variable handling

This commit is contained in:
Alexandre Iooss
2020-09-14 14:28:37 +02:00
parent 7fd4396624
commit 92b0f5244e
2 changed files with 10 additions and 8 deletions

View File

@ -27,10 +27,12 @@ def auth():
# so just ignore login here, and NGINX will still allow streaming.
return "Malformed request", 400
bind_dn = f"cn={name},{app.config.LDAP_USER_DN}"
ldap_user_dn = app.config.get('LDAP_USER_DN')
bind_dn = f"cn={name},{ldap_user_dn}"
try:
# Try to bind LDAP as the user
connect = ldap.initialize(app.config.LDAP_URI)
ldap_uri = app.config.get('LDAP_URI')
connect = ldap.initialize(ldap_uri)
connect.bind_s(bind_dn, password)
connect.unbind_s()
app.logger.info("%s logged in successfully", name)