can't map ldap3 search to django-python3-ldap config
See original GitHub issuehi
1st things 1st: thank you for sharing this codebase with the community!
I can’t seem to find the right configuration for the django plugin though, I have a working ldap3 example and trying to match it in my settings but always getting
LDAP connect failed: LDAPInvalidCredentialsResult - 49 - invalidCredentials - None - 80090308: LdapErr: DSID-0C0903A8, comment: AcceptSecurityContext error, data 52e, v1db1 - bindResponse - None
the following is a working example of search I’m doing with ldap3
from ldap3 import Server, Connection, ALL
print('### SERVER')
server = Server('host.group.domain.com', get_info=ALL)
print('### CONNECT')
conn = Connection(
server,
'CN=ldap_user,OU=SERVICE,OU=100 Common Services Objects,OU=Common Services and Applications,DC=group,DC=domain,DC=com',
'ldap_password',
auto_bind=True)
print('### SEARCH')
conn.search('DC=group,DC=domain,DC=com', '(&(sAMAccountName=username_search)(objectclass=user))')
print('### ENTRIES')
print([e for e in conn.entries])
I tried, among other combinations, the following
LDAP_AUTH_URL = 'ldap://host.group.domain.com:389'
LDAP_AUTH_SEARCH_BASE = 'DC=group,DC=domain,DC=com'
LDAP_AUTH_USER_FIELDS = {
'username': 'sAMAccountName',
'first_name': 'givenName',
'last_name': 'sn',
'email': 'mail'
}
LDAP_AUTH_CONNECTION_USERNAME = 'CN=ldap_user,OU=SERVICE,OU=100 Common Services Objects,OU=Common Services and Applications,DC=group,DC=domain,DC=com'
LDAP_AUTH_CONNECTION_PASSWORD = 'ldap_password'
LDAP_AUTH_FORMAT_USERNAME = "django_python3_ldap.utils.format_username_active_directory"
but always getting the invalid credential error. could you give a quick hint please? I’d be happy to help writing a bit of documentation if this use case is relevant for you
many thanks!
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Tutorial: searching LDAP entries — ldap3 2.9.1 documentation
To find entries in the DIT you must use the Search operation. This operation has a number of parameters, but only two of...
Read more >problem with django-python3-ldap : r/djangolearning
It would seem, this setting relates to DJANGO USER fields, not AD fields, which you can map as I have some common AD...
Read more >Django-python3-ldap - only certain active directory user ...
I can't remember what I did its so long ago now, but this is my LDAP config and I am using the ldap...
Read more >Web - Open / django-python3-ldap
Django LDAP user authentication backend for Python 3. ... LDAP_AUTH_USE_TLS = False # The LDAP search base for looking up users.
Read more >django-python3-ldap
django-python3-ldap provides a Django LDAP user authentication backend. ... PROTOCOL_TLSv1_2 # The LDAP search base for looking up users.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@binteezyy
For more info have a look at LDAP Search signature.
@sonicblind
Your answer has helped me a lot. I haven’t seen that link before or maybe I’m just too dumb. Thank you so much @grudelsud @sonicblind @etianen
Here is my final snippet for querying a specific user and a specific attribute from LDAP with a directory name connected to the User
from ldap3 import Server, Connection, SUBTREE, from django.conf import settings