[Zope] RE: LoginManager and LDAP

Phil Harris phil.harris@zope.co.uk
Wed, 21 Feb 2001 22:41:22 -0000


Corey,

Thank you *very* much, I'll be looking at this again tomorrow.  I hope to
have something working by the end of the week (if not the day with your
help).

Phil

----- Original Message -----
From: "Corey Zimmet" <caz@tcdi.com>
To: <phil.harris@zope.co.uk>
Cc: "Zope" <Zope@zope.org>
Sent: Wednesday, February 21, 2001 5:39 PM
Subject: [Zope] RE: LoginManager and LDAP


> I was able to do a basic test with LoginManager and
> ZLDAPConnection/ZLDAPMethods using Zope 2.2.4:
>
> In UserSource added these Python Methods:
> ------------------------------------------
> userAuthenticate:
>    parameter list: self,REQUEST,username,password
>
>    function body:
> return self.ldapAuthenticate(username,password)
>
> -------------------------------------------
> userDomains:
>    parameter list: self, REQUEST, username
>
>    function body:
> # I don't use this for my ldap implementation
> return []
>
> -------------------------------------------
> userExists:
>    parameter list: self,REQUEST,username
>
>    function body:
> return 1
>
> -------------------------------------------
> userRoles:
>    parameter list: self, REQUEST, username
>
>    function body:
> # call ldap method to get information on user
> results=self.getUserInfo(uid=username)
> row=results[0]
> return row.get('roles')
>
> -------------------------------------------
> ldapAuthenticate:
>   parameter list: self,username,password
>
>   function body:
> # call ldap method to get information on user
> results=self.getUserInfo(uid=username)
> # an external method that returns an md5 encrypted password
> password=self.md5_encrypt(password)
> if len(results)==0:
>    return 0
> elif len(results)>1:
>    return 0
> else:
>    row=results[0]
>    # userpassword is the name for the password in the ldap directory
>    if row.get('userpassword')[0]=="{MD5}%s"%(password,):
>       return 1
>    else:
>       return 0
> ---------------------------------------------
>
>
> Added this LDAPMethod:
> ------------------------------------
> getUserInfo:
>
> parameter list: uid
> query filter: uid=&dtml-uid;
>
> ---------------------------------------------
>
> Hope this helps,
> Corey
>
>
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )