diff --git a/README.md b/README.md index 5811f480e0416b94892d94d0350a33d2aa0dafc9..7f1c3548d35ae28df97b7a0f49fc9052cf1c50b6 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,18 @@ Flask-SimpleLDAP Flask-SimpleLDAP provides LDAP authentication for Flask. Quickstart -------- +---------- + +First, install Flask-SimpleLDAP: + + $ pip install flask-simpleldap + +Flask-SimpleLDAP depends, and will install for you, recent versions of Flask +(0.9 or later) and python-ldap. Flask-SimpleLDAP is compatible +with and tested on Python 2.6 and 2.7. + +Next, add a ``LDAP`` instance to your code and at least the three +required configuration options: from flask import Flask from flask.ext.simpleldap import LDAP @@ -16,6 +27,14 @@ Quickstart app.config['LDAP_USERNAME'] = 'CN=user,OU=Users,DC=example,DC=org' app.config['LDAP_PASSWORD'] = 'password' + @app.route('/ldap') + @ldap.login_required + def ldap_protected(): + return 'Success!' + + +Check the [examples](examples/) folder for a more complex example using LDAP groups. + Resources --------- diff --git a/docs/index.rst b/docs/index.rst index 6303a72f7d6c16de10628c14de6983db3f4df98d..6b3e77480c85a3451ef33e737a7d8ef2874f347d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -37,6 +37,11 @@ required configuration options: app.config['LDAP_USERNAME'] = 'CN=user,OU=Users,DC=example,DC=org' app.config['LDAP_PASSWORD'] = 'password' + @app.route('/ldap') + @ldap.login_required + def ldap_protected(): + return 'Success!' + Configuration -------------