Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 1.49 KB

install.rst

File metadata and controls

49 lines (34 loc) · 1.49 KB

Installation

Install the package with pip:

$ pip install cool-django-auth-ldap

It requires python-ldap >= 3.0. You'll need the OpenLDAP libraries and headers available on your system.

To use the auth backend in a Django project, add 'cool_django_auth_ldap.backend.LDAPBackend' to AUTHENTICATION_BACKENDS`m add cool_django_auth_ldap to :setting:`INSTALLED_APPS and run migrations.

AUTHENTICATION_BACKENDS = ["cool_django_auth_ldap.backend.LDAPBackend"]

INSTALLED_APPS = (
    ...
    "cool_django_auth_ldap"
    ...
)

~cool_django_auth_ldap.backend.LDAPBackend should work with custom user models, but it does assume that a database is present.

Note

~cool_django_auth_ldap.backend.LDAPBackend does not inherit from ~django.contrib.auth.backends.ModelBackend. It is possible to use ~cool_django_auth_ldap.backend.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 = [
    "cool_django_auth_ldap.backend.LDAPBackend",
    "django.contrib.auth.backends.ModelBackend",
]