UPDATED
How it is possible to Django default admin authenticate on a LDAP server instead of the default database? I have found the package Django Auth LDAP but nothing about configuring it to be used by admin login. I've tried putting the lines below within settings.py besides the LDAP configuration:
AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend',
'django.contrib.auth.backends.ModelBackend',
)
But it doesn't works. If I remove the last line, it doesn't authenticate on LDAP and shows me the default auth error, as the ModelBackend is a fallback. I've tried copying and modifying the configs listed in the documentation and I'm getting this error on console:
Caught LDAPError while authenticating karlisson: INVALID_DN_SYNTAX({'info': 'invalid DN', 'desc': 'Invalid DN syntax'},)
My settings.py:
AUTH_LDAP_SERVER_URI = "ldap://192.168.0.2"
AUTH_LDAP_BIND_DN = "example_nt"
AUTH_LDAP_BIND_PASSWORD = "example"
AUTH_LDAP_USER_SEARCH = LDAPSearch("cn=admin,dc=example_nt,dc=com,dc=br",
ldap.SCOPE_SUBTREE, "(uid=%(user)s)")
Have no idea where is the syntax error, LDAP beginner.