I am currently trying to use Flask-LDAP for authentication purposes for Sandman. Unlike normal python LDAP where the documentation is pretty straight forward, this is pretty offbase.
Example from documentation.
from flask import Flask
from flask.ext.ldap import LDAP, login_required
from flask.ext.pymongo import PyMongo
app = Flask(__name__)
app.debug = True
app.config['LDAP_HOST'] = 'ldap.example.com'
app.config['LDAP_DOMAIN'] = 'example.com'
app.config['LDAP_SEARCH_BASE'] = 'OU=Domain Users,DC=example,DC=com'
app.config['LDAP_LOGIN_VIEW'] = 'custom_login'
app.config['MONGO_DBNAME'] = 'simpledb'
mongo = PyMongo(app, config_prefix='MONGO')
ldap = LDAP(app, mongo)
app.secret_key = "welfhwdlhwdlfhwelfhwlehfwlehfelwehflwefwlehflwefhlwefhlewjfhwelfjhweflhweflhwel"
app.add_url_rule('/login', 'login', ldap.login, methods=['GET', 'POST'])
This does not tell me where I can place my dn or password. So I am completely confused as to how this thing actually works.
Has anyone effectively used Flask-LDAP and if so how did you set it up? Or is there a better product out there like flask-login that I should use?
Thanks,
The user will initiate the flask web application through the URL which displays the login form and the button to log in. Upon clicking the button the App will do an LDAP validation.
They should consider it if: a single piece of data needs to be found and accessed regularly; the organization has a lot of smaller data entries; the organization wants all smaller pieces of data in one centralized location, and there doesn't need to be an extreme amount of organization between the data.
Flask-login is okay and the de-facto lib for session management so you'll be needing that.
As for flask-ldap, yeah it's not well documented...
But this might be useful to you (it seems like a full feature ldap lib for flask including login helpers): flask_ldap_login at https://github.com/ContinuumIO/flask-ldap-login
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