Skip to content

Commit 0d17b37

Browse files
author
Richard Jones
committed
added simplistic LDAP authentication example
1 parent 7b2037a commit 0d17b37

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

doc/customizing.txt

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Customising Roundup
33
===================
44

5-
:Version: $Revision: 1.90 $
5+
:Version: $Revision: 1.91 $
66

77
.. This document borrows from the ZopeBook section on ZPT. The original is at:
88
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -3112,6 +3112,42 @@ now do all the work::
31123112
And that's it!
31133113

31143114

3115+
Using an LDAP database for user information
3116+
-------------------------------------------
3117+
3118+
A script that reads users from an LDAP store using
3119+
http://python-ldap.sf.net/ and then compares the list to the users in the
3120+
roundup user database would be pretty easy to write. You'd then have it run
3121+
once an hour / day (or on demand if you can work that into your LDAP store
3122+
workflow). See the example `Using a UN*X passwd file as the user database`_
3123+
for more information about doing this.
3124+
3125+
To authenticate off the LDAP store (rather than using the passwords in the
3126+
roundup user database) you'd use the same python-ldap module inside an
3127+
extension to the cgi interface. You'd do this by adding a method called
3128+
"verifyPassword" to the Client class in your tracker's interfaces.py
3129+
module. The method is implemented by default as::
3130+
3131+
def verifyPassword(self, userid, password):
3132+
''' Verify the password that the user has supplied
3133+
'''
3134+
stored = self.db.user.get(self.userid, 'password')
3135+
if password == stored:
3136+
return 1
3137+
if not password and not stored:
3138+
return 1
3139+
return 0
3140+
3141+
So you could reimplement this as something like::
3142+
3143+
def verifyPassword(self, userid, password):
3144+
''' Verify the password that the user has supplied
3145+
'''
3146+
# look up some unique LDAP information about the user
3147+
username = self.db.user.get(self.userid, 'username')
3148+
# now verify the password supplied against the LDAP store
3149+
3150+
31153151
Enabling display of either message summaries or the entire messages
31163152
-------------------------------------------------------------------
31173153

0 commit comments

Comments
 (0)