I am using Django 1.5 and Python 3. I am new to Django & LDAP in general.
I am including the following configuration (modified for my case) in my settings.py
file, which was taken from here:
AUTH_LDAP_SERVER_URI = "ldap://example.fr"
AUTH_LDAP_BIND_DN = 'cn=a_user,dc=example,dc=fr'
AUTH_LDAP_BIND_PASSWORD=''
AUTH_LDAP_USER_SEARCH = LDAPSearch('ou=users,dc=example,dc=fr', ldap.SCOPE_SUBTREE, '(uid=%(user)s)')
AUTH_LDAP_GROUP_SEARCH = LDAPSearch('ou=groups,dc=example,dc=fr', ldap.SCOPE_SUBTREE, '(objectClass=groupOfNames)')
AUTH_LDAP_GROUP_TYPE = ActiveDirectoryGroupType()
#Populate the Django user from the LDAP directory
AUTH_LDAP_USER_ATTR_MAP = {
'first_name': 'sAMAccountName',
'last_name': 'displayName',
'email': 'mail'
}
AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend',
'django.contrib.auth.backends.ModelBackend',
)
However, I have also followed the discussion here where it says that, the django-auth-ldap
module is not ported to Python 3.
I have a couple of questions:
What are the module imports that need to go into the
settings.py
file in order to get the configuration above to work?Which of those imports are not available for Python 3?
Is it possible to get LDAP-based authentication going for Django with Python 3? Is it some modification of the approach above, or something different?
Any advice appreciated.