0

I'm trying to build user authentication against our LDAP using django-auth-ldap package.

settings.py

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

 import ldap
 from django_auth_ldap.config import LDAPSearch, GroupOfNamesType


 # Baseline configuration.
 AUTH_LDAP_SERVER_URI = "ldap://ldap.example.com"

 AUTH_LDAP_BIND_DN = "cn=ldap_user,ou=PEOPLE, dc=example,dc=com"
 AUTH_LDAP_BIND_PASSWORD = "test123"
 AUTH_LDAP_USER_SEARCH = LDAPSearch("ou=PEOPLE,dc=example,dc=com",
         ldap.SCOPE_SUBTREE, "(cn=%(user)s)")



 # Populate the Django user from the LDAP directory.
 AUTH_LDAP_USER_ATTR_MAP = {
     "first_name": "givenName",
     "last_name": "sn",
     "email": "mail"
     }

The above configuration works only for AUTH_LDAP_BIND_DN user (i.e ldap_user), but if i login using other name, authentication will fails.

And also check all my users are in PEOPLE group.

Why this configuration works only for one user?

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
Asif
  • 1,775
  • 4
  • 25
  • 39
  • Can't see anything obviously wrong but I found enable logging as [here](http://packages.python.org/django-auth-ldap/#logging) gave very helpful information when I was setting up authenticating against AD. Maybe you can try. – slackjake Nov 06 '12 at 07:17
  • Where do you define the `PEOPLE` in `ou=PEOPLE`? – rofls Nov 06 '12 at 08:48
  • 1
    I just replaced "sAMAccountName=%(user)s)" and it works. Thank you – Asif Nov 06 '12 at 09:12

0 Answers0