I went to basic_auth.py file in Dash-Auth and changed the is_authorized function to return True or False based on a LDAP authentication function.
header = flask.request.headers.get('Authorization', None) if not header: return False username_password = base64.b64decode(header.split('Basic ')) username_password_utf8 = username_password.decode('utf-8') username, password = username_password_utf8.split(':') return ldap_auth(username, password)
It actually works fine, but the problem is that it runs this method and reconnects to the LDAP server every time a component updates, making the app slower.
Is this BasicAuth behavior intended?
Is there a way to have it verify/authenticate only when the user opens a session?
Should I use something like Flask-Login instead?
Sorry if these are silly questions. I’m very new in LDAP/Auth stuff, so I’m not even sure I’m using the correct terms to describe the problem.
Thanks in advance.