[Solved]-LDAP authentication with django REST

12👍

There is a package called django-auth-ldap.
It comes with a django authentification backend.
Just add django_auth_ldap.backend.LDAPBackend to your AUTHENTICATION_BACKENDS

AUTHENTICATION_BACKENDS = (
    'django_auth_ldap.backend.LDAPBackend',
    'django.contrib.auth.backends.ModelBackend',
)

You probably have to define a few more settings like you ldap host. But the documentation is quite good.

Then you can use your normal authentication views and django “decide” which method to use. There is more information in the django docs

Leave a comment