--- id: django-auth-ldap version: "5.3.0" license: BSD license_treatment: permissive maintenance: active --- # django-auth-ldap — Django LDAP authentication backend License: permissive · Maintenance: active · Downloads: 693.3K/mo ## 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 above — verify before relying. Provides a Django authentication backend that validates user credentials against an LDAP directory service, supporting user search, group membership, and permission mapping. 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 pip install django-auth-ldap uv add django-auth-ldap poetry add django-auth-ldap ## Installing django-auth-ldap 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. 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', ] Requires OpenLDAP libraries and headers available on your system; python-ldap >= 3.1 must be installed. 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_current - Install friction: low - Maintenance: active - Downloads: 693.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django ldap authentication, ldap backend django, active directory django auth, ldap user authentication, django directory services, ldap group permissions django, enterprise directory integration, ldap-authentication, enterprise-identity, directory-services [View on SkillFed](https://skillfed.io/packages/django-auth-ldap) · [View on PyPI](https://pypi.org/project/django-auth-ldap/)