user1443144
user1443144

Reputation: 97

LDAP authentication in Django

I'm very new to Django and LDAP ... any help is is appreciated.

So i'm trying to setup and ldaps in Django. I'm trying to follow this (http://packages.python.org/django-auth-ldap/) instruction, but i have few questions ...

  1. Where is AUTHENTICATION_BACKENDS located? So that i can add django_auth_ldap.backend.LDAPBackend
  2. Where is AUTH_LDAP_SERVER_URI?

If i get the solutions to these i maybe able to figure out the rest ...

Thanks a lot for looking into this.

Upvotes: 2

Views: 2566

Answers (1)

cyroxx
cyroxx

Reputation: 3877

AUTHENTICATION_BACKENDS should be located in your settings.py. This is where almost all configuration is done.

For AUTH_LDAP_SERVER_URI, I think you need to add this as a global variable to your settings.py.

You may also take a quick look at the example configuration on the page you referred to.


EDIT

You are right, those variables are not present in the initial settings.py. You need to add the following to your settings.py:

# Keep ModelBackend around for per-user permissions and maybe a local
# superuser.
AUTHENTICATION_BACKENDS = (
    'django_auth_ldap.backend.LDAPBackend',
    'django.contrib.auth.backends.ModelBackend',
)

AUTH_LDAP_SERVER_URI = "ldap://ldap.example.com"  # replace by the real URI

Upvotes: 4

Related Questions