diff --git a/README.md b/README.md index 33b0ecaabda535a378162884db666a5bae254893..673b7be09b6f9166e8d8aa5f8d97948daa24d49b 100644 --- a/README.md +++ b/README.md @@ -19,21 +19,22 @@ 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 - - app = Flask(__name__) - ldap = LDAP(app) - - app.config['LDAP_BASE_DN'] = 'OU=users,dc=example,dc=org' - 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!' - +```python +from flask import Flask +from flask.ext.simpleldap import LDAP + +app = Flask(__name__) +ldap = LDAP(app) + +app.config['LDAP_BASE_DN'] = 'OU=users,dc=example,dc=org' +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.