Ask Your Question
2

ldap login works during initial login/registration, but fails to recognize existing user if relogging in.

asked 2012-04-11 15:32:04 -0500

timewasted gravatar image

I'm setting up a new install of askbot and have everything working, with the exception of ldap. I can log into the system and it correctly authenticates against my ldap server, creating the user account. The problem comes in with logging out of the system. When you go to log back in, it is as if askbot doesn't recognize that the user is already registered in askbot. if you attempt to put your display name and email address back in, you get a duplicate key error.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-04-12 13:04:48 -0500

timewasted gravatar image

updated 2012-04-12 16:39:03 -0500

I was able to figure this out. in askbot/deps/django_authopenid/backends.py, I had to add a line to bind to the server (our server requires authentication prior to being able to search the tree).

 32         user_filter = "({0}={1})".format(askbot_settings.LDAP_USERID_FIELD,
 33                                          username)
 34 
 35         # Attempt at doing a simple bind to the ldap server
 36         # This is needed before being alllowed to search the ldap tree
 37         ldap_session.simple_bind_s("full_path_to_admin_user", "password")
 38 
 39         # search ldap directory for user
 40         res = ldap_session.search_s(askbot_settings.LDAP_BASEDN, ldap.SCOPE_SUBTREE, user_filter, None)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-04-11 15:32:04 -0500

Seen: 597 times

Last updated: Apr 12 '12