2

I am authenticating users who login against through django REST framework against NIS using pythonPAM . But when I make the changes to settings.py as mentioned below, user credentials isnt being verified against LDAP.

AUTHENTICATION_BACKENDS = (
    'django_auth_ldap.backend.LDAPBackend',
)

This along with ldap credentials for binding is used. Note: I can connect to LDAP server and get all teh details. Its only a problem with django restframework.

I also tried

AUTHENTICATION_BACKENDS =  [ 'django.contrib.auth.backends.RemoteUserBackend',]

and it did not work.

Currently in my urls.py, I call url(/login,) endpoint and authenticate against NIS server. How do I change it to LDAP?

I am new to django and need help on this.

EzLo
  • 13,780
  • 10
  • 33
  • 38
proc
  • 36
  • 2
  • So what happens when you try and authenticate using the `LDAPBackend`? Do you get an error, or just an authentication failure and no error? – Will Keeling Jan 10 '19 at 15:54
  • 1
    So, I was getting credentials error, and I couldn't understand if it was LDAP rejecting it or the settings.py was not taking in the changes. i put 'all-auth ' in installed apps setting in settings.py and did enchanced logging as mentioned in post https://stackoverflow.com/questions/40048962/django-auth-ldap-failed-authentication . Now it is authenticating. Django 1.11 needs more configuration with LDAP i guess. – proc Jan 11 '19 at 00:58
  • AUTHENTICATION_BACKENDS = ( 'django_auth_ldap.backend.LDAPBackend', ) worked after I corrected the ldap settiings – proc May 29 '20 at 01:38

0 Answers0