django-environ
django-environ copied to clipboard
Deprecate LDAP support
The current LDAP URL Schema parsing does not work well. It can't even handle canonical RFC examples, let alone be capable of validation.
Given that the maintainers of this project are not strong in this area, and that there are more professional solutions for parsing LDAP URLs, I want to suggest deprecating and removing LDAP parsing support from the project.
The responsibility of the project should be to work with environment variables and do it well, not to be able to parse every conceivable URL schema. I wouldn't want to spend more time on this to deal with a subject area from which I am too far away. In addition, I would like to strive to ensure that the project becomes simpler, more stable and more predictable.
As for the current users (if there are any at all). Migrating to another solution is quite simple, for example using python-ldap:
import environ
from ldapurl import LDAPUrl
env = environ.Env()
ldap_url = LDAPUrl(ldapUrl=env.str('SOPHISTICATED_LDAP_URL'))
db_url = {
'ENGINE': 'ldapdb.backends.ldap',
'HOST': ldap_url.hostport.rsplit(':')[0],
'PASSWORD': ldap_url.cred,
'PORT': ldap_url.hostport.rsplit(':')[1],
'USER': ldap_url.who,
# Other options ...
}
Some projects that obviously have a better understanding of this area:
- https://github.com/python-ldap/python-ldap
- https://github.com/django-ldapdb/django-ldapdb
- https://github.com/etianen/django-python3-ldap
- https://github.com/django-auth-ldap/django-auth-ldap
/cc @joke2k