Skip to content
Snippets Groups Projects
Select Git revision
  • ldapi-support
  • master default
  • v1.3.3
  • v1.4.0
  • v1.3.2
  • v1.3.0
  • v1.1.2
  • v1.1.1
  • v1.1.0
  • v1.0.1
  • v1.0.0
  • v0.4.0
  • v0.2.0
  • v0.3.0
  • v0.1.1
  • v0.1.0
16 results

flask-simpleldap

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Alexandre Ferland authored
    f657f621
    History

    Flask-SimpleLDAP

    Build Status

    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
    
    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 folder for a more complex example using LDAP groups.

    Resources