Hi all, I'm having a strange problem. I wrote a basic LDAP backend, to authenticate users against our open directory server:
from django.contrib.auth.models import User import ldap import ldap.sasl class LDAPBackend: def authenticate(self, username=None, password=None): if username and password: ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER) directory = 'ldaps://MYSERVERURL' base_dn = 'MYBASEDN' scope = ldap.SCOPE_SUBTREE con = ldap.initialize(directory) auth_tokens = ldap.sasl.cram_md5(username, password) try: con.sasl_interactive_bind_s("", auth_tokens) except ldap.LDAPError: return None con.unbind() return self.get_user(username) return None def get_user(self, username): try: user = User.objects.get(username=username) print user return user except User.DoesNotExist: return None Now, I know this works, because a) it works just lovely in the shell and b) I get this output when I try a login: Django version 1.0.2 final, using settings 'reviews.settings' Development server is running at http://0.0.0.0:80/ Quit the server with CONTROL-C. brenton [11/Aug/2009 13:25:01] "POST /admin/ HTTP/1.1" 302 0 [11/Aug/2009 13:25:01] "GET /admin/ HTTP/1.1" 200 1511 Note that the print user line works, so a valid user is being returned, meaning the bind works just fine. The problem I am getting is that the GET /admin/ is returning me to the login form, without any errors, over and over. A login using a user from the django db works without a problem. Any suggestions? Thanks, Brenton. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---