InstallationΒΆ

This authentication backend enables a Django project to authenticate against any LDAP server. To use it, add django_auth_ldap.backend.LDAPBackend to AUTHENTICATION_BACKENDS. Adding django_auth_ldap to INSTALLED_APPS is not recommended unless you would like to run the unit tests. LDAP configuration can be as simple as a single distinguished name template, but there are many rich options for working with User objects, groups, and permissions. This backend depends on the python-ldap module.

Note

LDAPBackend does not inherit from ModelBackend. It is possible to use LDAPBackend exclusively by configuring it to draw group membership from the LDAP server. However, if you would like to assign permissions to individual users or add users to groups within Django, you’ll need to have both backends installed:

AUTHENTICATION_BACKENDS = (
    'django_auth_ldap.backend.LDAPBackend',
    'django.contrib.auth.backends.ModelBackend',
)