Open Plaoo opened 2 years ago
Please enable logging and paste the log output into this issue.
https://github.com/etianen/django-python3-ldap#logging
Sorry for the delay in replying!
On Mon, 7 Mar 2022 at 10:39, Paolo Monni @.***> wrote:
Hi everyone, I'm trying to implement LDAP on a project that uses rest framework, as the documentation says, you need to add AUTHENTICATION_BACKENDS, but if I do I can't log in from the frontend.
In the settings it is set like this
REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'django_rest_multitokenauth.coreauthentication.MultiTokenAuthentication', 'rest_framework.authentication.BasicAuthentication',
)
}
If add
AUTHENTICATION_BACKENDS = ( 'django_python3_ldap.auth.LDAPBackend', 'django.contrib.auth.backends.ModelBackend', )
I can't log in normally anymore and if I add 'django_python3_ldap.auth.LDAPBackend', to DEFAULT_AUTHENTICATION_CLASSES, same.
This is my ldap settings on django settings:
LDAP Config ---
docker0LDAP_AUTH_URL = "ldap://172.17.0.1:389"LDAP_AUTH_USE_TLS = False
LDAP_AUTH_SEARCH_BASE = "cn=users,ou=group,dc=example,dc=org"#LDAP_AUTH_SEARCH_BASE = "ou=group,dc=example,dc=org"#LDAP_AUTH_SEARCH_BASE = "dc=example,dc=org" LDAP_AUTH_OBJECT_CLASS = "inetOrgPerson" LDAP_AUTH_USER_FIELDS = { "username": "uid", "first_name": "givenName", "last_name": "sn", "email": "mail", }
A tuple of django model fields used to uniquely identify a user.LDAP_AUTH_USER_LOOKUP_FIELDS = ("email", "password")
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_openldap"LDAP_AUTH_ACTIVE_DIRECTORY_DOMAIN = None
The LDAP username and password of a user for querying the LDAP database for user# details. If None, then the authenticated user will be used for querying, and# the
ldap_sync_users
command will perform an anonymous query.LDAP_AUTH_CONNECTION_USERNAME = 'cn=admin,dc=example,dc=org'LDAP_AUTH_CONNECTION_PASSWORD = 'admin'LDAP_AUTH_OBJECT_CLASS = "operator"# Set connection/receive timeouts (in seconds) on the underlyingldap3
library.LDAP_AUTH_CONNECT_TIMEOUT = NoneLDAP_AUTH_RECEIVE_TIMEOUT = NoneLDAP Config End ---
commands: docker-compose exec stip_company python manage.py ldap_sync_users
return
CommandError: Could not connect to LDAP server
from ldap server
openldap | 6225df35 conn=1049 fd=12 ACCEPT from IP=172.25.0.1:47262 (IP=0.0.0.0:389) openldap | 6225df35 conn=1049 op=0 BIND dn="mail=cn\3Dadmin\2Cdc\3Dexample\2Cdc\3Dorg,cn=users,ou=group,dc=example,dc=org" method=128 openldap | 6225df35 conn=1049 op=0 RESULT tag=97 err=49 text= openldap | 6225df3a conn=1049 op=1 UNBIND openldap | 6225df3a conn=1049 fd=12 closed
— Reply to this email directly, view it on GitHub https://github.com/etianen/django-python3-ldap/issues/239, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABEKCGVHSNQXQYN5XVYPH3U6XMFHANCNFSM5QC4JGKA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hi everyone, I'm trying to implement LDAP on a project that uses rest framework, as the documentation says, you need to add AUTHENTICATION_BACKENDS, but if I do I can't log in from the frontend.
In the settings it is set like this
If add
I can't log in normally anymore and if I add
'django_python3_ldap.auth.LDAPBackend',
to DEFAULT_AUTHENTICATION_CLASSES, same.This is my ldap settings on django settings:
commands:
docker-compose exec stip_company python manage.py ldap_sync_users
return
from ldap server
UPDATE: I tried to connect using the lib ldap3 and I succeeded. The difference is in the logs ldap connection:
log:
if I try with django:
I think this is the problem
openldap | 62263235 conn=1240 op=0 BIND dn="mail=cn\3Dadmin\2Cdc\3Dexample