I have made flask web app meant to be used within my organisation.
My problem is currently the login works by requesting a username and password from the user which are then authenticated by an LDAP server.
I would like to be able to autologin a user immediately he gets onto the site since that's how other company internal websites work(these others were made in C# and php)
My main problem is:
Requests-ntlm was once suggested but it has no documentation.
I have tried to look at several stack overflow questions but they do not address my problem eg link
To install it, type sudo apt install python3-venv in your terminal and then you are good to go. If you are on windows then use something like virtualenv to make a virtual environment. This will create a folder named venv in the flask project which will contain the project specific libraries.
It has taken me weeks to find the answer but Yes it is possible but you must configure the server where your app is hosted to allow this. In my case I was using IIS and enabled windows authentication. With this its surprisingly easy to get the active directory user name as it comes as part of the HTTP response:
from flask import request
username = request.environ.get('REMOTE_USER')
See this question for more information:
How to access Apache Basic Authentication user in Flask
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With