Skip to content
Snippets Groups Projects
Commit 00cb25eb authored by admiralobvious's avatar admiralobvious
Browse files

Added example to README

parent 4e9ca49e
Branches
Tags
No related merge requests found
......@@ -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
---------
......
......@@ -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
-------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment