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?