LDAP user lookup failed
See original GitHub issueHi, thanks for all the work in creating this package, really appreciated.
I’m in the process of implementing LDAP for my project and I am coming unstuck trying to return a user profile from the LDAP server. The server logs are saying that the connection is being made successfully, but it is failing to bind during the get_user function of ldap.py.
This is my settings.py ldap options:
AUTHENTICATION_BACKENDS = (
"django_python3_ldap.auth.LDAPBackend",
'django.contrib.auth.backends.ModelBackend',
)
LDAP_AUTH_URL = "ldap://server.org.thing.uk:389"
LDAP_AUTH_USE_TLS = False
LDAP_AUTH_SEARCH_BASE = "OU=User Objects - Employee Accounts,OU=Administrated Objects,DC=org,DC=thing,DC=uk"
LDAP_AUTH_OBJECT_CLASS = "inetOrgPerson"
LDAP_AUTH_USER_FIELDS = {
"username": "uid",
"first_name": "givenName",
"last_name": "sn",
"email": "mail",
}
LDAP_AUTH_USER_LOOKUP_FIELDS = ("username",)
LDAP_AUTH_CLEAN_USER_DATA = "django_python3_ldap.utils.clean_user_data"
LDAP_AUTH_SYNC_USER_RELATIONS = "django_python3_ldap.utils.sync_user_relations"
LDAP_AUTH_FORMAT_SEARCH_FILTERS = "django_python3_ldap.utils.format_search_filters"
LDAP_AUTH_FORMAT_USERNAME = "django_python3_ldap.utils.format_username_active_directory"
LDAP_AUTH_ACTIVE_DIRECTORY_DOMAIN = "ORG"
LDAP_AUTH_CONNECTION_USERNAME = "Perc.Auth.SRV"
LDAP_AUTH_CONNECTION_PASSWORD = "************"
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"handlers": {
"console": {
"class": "logging.StreamHandler",
},
},
"loggers": {
"django_python3_ldap": {
"handlers": ["console"],
"level": "INFO",
},
},
}
If I print out the self._connection.search from get_user in ldap.py, I get the following:
<bound method Connection.search of Connection(server=Server(host='server.org.thing.uk', port=389, use_ssl=False, allowed_referral_hosts=[('*', True)], get_info='NO_INFO', mode='IP_V6_PREFERRED'), user='ORG\\Perc.Auth.SRV', p assword='**********', auto_bind='NO_TLS', version=3, authentication='SIMPLE', client_strategy='SYNC', auto_referrals=True, check_names=True, read_only=False, lazy=False, raise_exceptions=True, fast_decoder=True, auto_range=True, return_empty_attributes=T rue)>
However, this does not trigger the if statement in get_user and therefore does not complete the lookup. Any help would be appreciated!
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
After trying many different settings, I tried changing the LDAP_AUTH_OBJECT_CLASS and theLDAP_AUTH_USER_FIELDS and it worked!
Try with the following:
Apparently some AD LDAP servers work with that configuration of object class. Good luck!
Same error for me here trying to connect a local Microsoft Active Directory ©®. Solved with the help of my domain administrator with :
LDAP_AUTH_OBJECT_CLASS = "person"
Thx for this brilliant package !