From d2425c2c4d22a0829611109501b62a362a5d5725 Mon Sep 17 00:00:00 2001 From: Maxime Boissonneault Date: Wed, 22 Jul 2026 14:44:15 -0400 Subject: [PATCH] AUTH_LDAP_BIND_DN must be a string, not a tuple, use the staffLdapBackend and implement staff and access attributes for LDAP auth --- templates/91-local.py.epp | 2 +- templates/92-local_ldap.py.epp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/91-local.py.epp b/templates/91-local.py.epp index 00449db..5e8297e 100644 --- a/templates/91-local.py.epp +++ b/templates/91-local.py.epp @@ -10,7 +10,7 @@ ALLOWED_HOSTS = ['<%= $subdomain %>.<%= $domain_name%>', '127.0.0.1', 'localhost CSRF_TRUSTED_ORIGINS = [BASE_URL.strip('/')] AUTH_LDAP_SERVER_URI = 'ldaps://ipa.int.<%= $domain_name %>/' -AUTH_LDAP_BIND_DN = 'uid=admin,cn=users,cn=accounts,<%= $base_dn %>', +AUTH_LDAP_BIND_DN = 'uid=admin,cn=users,cn=accounts,<%= $base_dn %>' AUTH_LDAP_BIND_PASSWORD = '<%= $ldap_password %>' AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,cn=users,cn=accounts,<%= $base_dn %>" diff --git a/templates/92-local_ldap.py.epp b/templates/92-local_ldap.py.epp index ec021ed..661ee97 100644 --- a/templates/92-local_ldap.py.epp +++ b/templates/92-local_ldap.py.epp @@ -1,2 +1,4 @@ -AUTHENTICATION_BACKENDS += ['django_auth_ldap.backend.LDAPBackend'] +AUTHENTICATION_BACKENDS += ['userportal.authentication.staffLdapBackend'] LOGIN_URL = '/accounts/login/' # So it does not use SAML2 +LDAP_CONFIG['required_access_attributes'] = REQUIRED_ACCESS_ATTRIBUTES +LDAP_CONFIG['staff_attributes'] = STAFF_ATTRIBUTES