forked from kompetenzinventar/ki-backend
pass ldap environment variables
This commit is contained in:
parent
574ce1f982
commit
7eee46d06b
4
app.py
4
app.py
@ -32,7 +32,9 @@ app.config["CORS_ORIGINS"] = os.getenv("CORS_ORIGINS", "*")
|
||||
|
||||
app.config["KI_AUTH"] = os.getenv("KI_AUTH")
|
||||
app.config["KI_LDAP_URL"] = os.getenv("KI_LDAP_URL")
|
||||
app.config["KI_LDAP_ROOT_DN"] = os.getenv("KI_LDAP_ROOT_DN")
|
||||
app.config["KI_LDAP_AUTH_USER"] = os.getenv("KI_LDAP_AUTH_USER")
|
||||
app.config["KI_LDAP_AUTH_PASSWORD"] = os.getenv("KI_LDAP_AUTH_PASSWORD")
|
||||
app.config["KI_LDAP_BASE_DN"] = os.getenv("KI_LDAP_BASE_DN")
|
||||
|
||||
CORS(app)
|
||||
db = SQLAlchemy(app)
|
||||
|
@ -60,7 +60,11 @@ def ldap_auth(username, password):
|
||||
return None
|
||||
|
||||
if not connection.search(app.config['KI_LDAP_BASE_DN'], f"(&(objectClass=inetOrgPerson)(uid={escaped_username}))"):
|
||||
app.logger.info(f"ldap search of {username} failed")
|
||||
app.logger.info("ldap search failed")
|
||||
return None
|
||||
|
||||
if not connection.entries:
|
||||
app.logger.info(f"no ldap search result for {username}")
|
||||
return None
|
||||
|
||||
user_dn = connection.entries[0].entry_dn
|
||||
|
Loading…
Reference in New Issue
Block a user