django-auth-ldap
Django LDAP authentication backend
Decision gist · record as of 2026-08-14
Yes, if you need LDAP authentication in Django. The package is actively maintained, has no known vulnerabilities, low install friction (aside from system OpenLDAP libraries), and is widely used in enterprise environments. The BSD license is permissive. Install only if your deployment uses LDAP or Active Directory; it adds no value for applications with local-only authentication.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires OpenLDAP libraries and headers available on your system; python-ldap >= 3.1 must be installed.
- Low friction installation with a pure-Python wheel.
- Actively maintained with recent commits and no known vulnerabilities.
License · maintenance · safety
BSD (permissive) — BSD 2-Clause license is permissive and imposes minimal restrictions on use, modification, and distribution in both open-source and proprietary projects.
last release 2025-12-26 (231 days) · last repo commit 2026-08-14 · 376 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 693,255 downloads/mo, #5,316 on PyPI
Alternatives
Verify before relying
pip install django-auth-ldap
# In Django settings.py:
from django_auth_ldap.config import LDAPSearch
import ldap
AUTH_LDAP_SERVER_URI = 'ldap://ldap.example.com'
AUTH_LDAP_USER_SEARCH = LDAPSearch(
'ou=users,dc=example,dc=com',
ldap.SCOPE_SUBTREE,
'(uid=%(user)s)',
)
AUTHENTICATION_BACKENDS = [
'django_auth_ldap.backend.LDAPBackend',
]- Whether the package supports LDAP over SSL/TLS by default or requires additional configuration.
- Performance characteristics when syncing large numbers of users or groups from LDAP.
- Whether custom user model support includes all edge cases or has known limitations.
What it is and what it does
django-auth-ldap is a Django authentication backend that delegates user authentication to an LDAP directory service such as Active Directory or OpenLDAP. Instead of storing passwords in Django's database, it validates credentials against your organization's directory, allowing centralized identity management. The package handles user lookup via LDAP search or distinguished name templates, maps LDAP attributes to Django user fields, and can derive group membership and permissions directly from LDAP groups.
The backend integrates into Django's authentication system by registering as a custom backend in AUTHENTICATION_BACKENDS. It supports rich configuration for user discovery, group restrictions, attribute mapping, and permission calculation. You can use it alongside Django's built-in ModelBackend to combine LDAP authentication with local permissions, or run it exclusively with LDAP-sourced groups. The package caches LDAP queries to reduce directory traffic and works with custom user models.
Use it for
- Authenticate Django users against an Active Directory or OpenLDAP directory in an enterprise environment.
- Map LDAP group membership to Django user flags (is_staff, is_superuser) and permissions without local database management.
- Populate Django user profiles (name, email) automatically from LDAP attributes on first login.
- Restrict Django application access to specific LDAP groups while allowing others to be denied.
- Migrate from local password storage to centralized directory authentication in an existing Django project.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need LDAP authentication in Django.
The package is actively maintained, has no known vulnerabilities, low install friction (aside from system OpenLDAP libraries), and is widely used in enterprise environments. The BSD license is permissive. Install only if your deployment uses LDAP or Active Directory; it adds no value for applications with local-only authentication.
Install
django-auth-ldap on PyPI
Before you install
Low friction installation with a pure-Python wheel. Actively maintained with recent commits and no known vulnerabilities. Requires OpenLDAP libraries and headers on the system, and python-ldap >= 3.1 as a runtime dependency.
Requires OpenLDAP libraries and headers available on your system; python-ldap >= 3.1 must be installed.
License in practice
BSD 2-Clause license is permissive and imposes minimal restrictions on use, modification, and distribution in both open-source and proprietary projects.
Quickstart
pip install django-auth-ldap
# In Django settings.py:
from django_auth_ldap.config import LDAPSearch
import ldap
AUTH_LDAP_SERVER_URI = 'ldap://ldap.example.com'
AUTH_LDAP_USER_SEARCH = LDAPSearch(
'ou=users,dc=example,dc=com',
ldap.SCOPE_SUBTREE,
'(uid=%(user)s)',
)
AUTHENTICATION_BACKENDS = [
'django_auth_ldap.backend.LDAPBackend',
]
Verify before relying
- Whether the package supports LDAP over SSL/TLS by default or requires additional configuration.
- Performance characteristics when syncing large numbers of users or groups from LDAP.
- Whether custom user model support includes all edge cases or has known limitations.
Package facts
| License | BSD permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesDjangopython-ldap |
| Maintenance | Actively maintained 231 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 693,255 / month, #5,316 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: BSD LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Internet :: WWW/HTTPTopic :: Software Development :: Libraries :: Python ModulesTopic :: System :: Systems Administration :: Authentication/Directory :: LDAP |
Evidence: django_auth_ldap-5.3.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “django ldap authentication”
- django-auth-ldapProvides a Django authentication backend that validates user…
- ldap3ldap3 is a pure Python LDAP V3 client library that implements RFC…
- python-ldapProvides an object-oriented Python API to connect to and query LDAP…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also python-ldap · ldaptor · django-authlib · bloodhound · python3-ldap · ldapdomaindump · django-sesame · python-active-directory · msldap · auth