From 00cb25eb19e9fe09420dede53a89ea1ee9ca165a Mon Sep 17 00:00:00 2001 From: admiralobvious <aferlandqc@gmail.com> Date: Sun, 10 Aug 2014 08:41:37 -0400 Subject: [PATCH] Added example to README --- README.md | 21 ++++++++++++++++++++- docs/index.rst | 5 +++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5811f48..7f1c354 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 6303a72..6b3e774 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 ------------- -- GitLab