4👍
There seems to be (still) no direct LDAP integration provided by allauth (no “ldap” is mentioned in neither the source code nor the documentation). Hence,
- LDAP needs to be integrated with another Python package (python-ldap or django-auth-ldap), first.
- User creation in
allauth
then needs to be customized via DefaultAccountAdapter (allauth docs) probably, depending on your needs and potential username conflicts. GitHub issue 199 explains some of the problematics.
Note that this solution applies to the case of a combined use of allauth and LDAP. If you want to use LDAP exclusively for authentication then keeping allauth in the codebase probably makes little sense, or may just be an overhead; you’ll have to tear it out.
1👍
ldap configuration is fairly simple in django. I use the following settings for my application. I also use a python library called python-ldap
AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend',
)
AUTH_LDAP_SERVER_URI = "ldap://127.0.0.1:389"
AUTH_LDAP_USER_SEARCH = LDAPSearch("ou=People,dc=local,dc=domain,dc=com",
ldap.SCOPE_SUBTREE, "(uid=%(user)s)")
AUTH_LDAP_USER_ATTR_MAP = {
"first_name": "givenName",
"last_name": "sn",
}
- [Django]-What is the best way to have all the timezones as choices for a Django model?
- [Django]-Prevent multiple logins using the same credentials
- [Django]-Prevent skip in docker-compose
Source:stackexchange.com