Strange problem with LDAP authentication backend

2009-08-12 Thread stupidgeek
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

Re: Strange problem with LDAP authentication backend

2009-08-12 Thread Peter Herndon
On 08/12/2009 11:17 AM, stupidgeek wrote: > Hi all, > > I'm having a strange problem. I wrote a basic LDAP backend, to > authenticate users against our open directory server: > > [snip] > > Note that the print user line works, so a valid user is being > returned, meaning the bind works just f

Re: Strange problem with LDAP authentication backend

2009-08-12 Thread stupidgeek
Hi Peter, Thanks for your input, but I am afraid to say that you are indeed wrong =( Ha. The user that I am trying to login as (me) has superuser premissions; by no errors, I mean that I get a plain login form - no red box telling me something went wrong. Thanks again for the input, and I'll gr

Re: Strange problem with LDAP authentication backend

2009-08-12 Thread David De La Harpe Golden
stupidgeek wrote: > def get_user(self, username): > try: >user = User.objects.get(username=username) >print user >return user > except User.DoesNotExist: > return None > Note part of the auth backend protocol AFAICS involves c

Re: Strange problem with LDAP authentication backend

2009-08-12 Thread stupidgeek
David, you are a champ, thank you. I find it strange that this made the difference, since this line is in the docs: "The get_user method takes a user_id -- which could be a username, database ID or whatever -- and returns a User object." But, making the change to user_id worked just fine. For ev

Re: Strange problem with LDAP authentication backend

2009-08-13 Thread David De La Harpe Golden
stupidgeek wrote: > David, you are a champ, thank you. > I find it strange that this made the difference, since this line is in > the docs: > > "The get_user method takes a user_id -- which could be a username, > database ID or whatever -- and returns a User object." > We-ell, the "user_id" it