[Zope] including (mysql)-auth-scheme into SimpleUserFolders

andy toenz zyta2002@web.de
Wed, 20 Nov 2002 17:33:16 +0100


Hello,

SUF works fine for me, using unencrypted passwords from a mysql-database.
The problem is: my passwords _are_ encrypted using the sql-method 'Password'.

I've found a Zope mysql-scheme patch (http://collector.zope.org/Zope/435/) that provides what i need... But I've no idea how I have to modify SimpleUserFolders to accept the mysql-scheme-patch :/

I've a user.py in SUF thats ihnerited from BasicUser...
In BasicUser, there's a authenticate-method.

.def authenticate(self, password, request):
.        passwrd=self._getPassword()
.        result = AuthEncoding.pw_validate(passwrd, password)
.        domains=self.getDomains()
.        if domains:
.            return result and domainSpecMatch(domains, request)
.        return result

So SUF uses AuthEncoding.pw_validate(passwrd, password) to check my pass, right ?

.def pw_validate(reference, attempt):
.    """Validate the provided password string, which uses LDAP-style encoding
.    notation.  Reference is the correct password, attempt is clear text
.    password attempt."""
.    for id, prefix, scheme in _schemes:
.        lp = len(prefix)
.        if reference[:lp] == prefix:
.            return scheme.validate(reference[lp:], attempt)
.    # Assume cleartext.
.    return (reference == attempt)

But this looks like LDAP-Style Encoding and not the MySQL-Scheme way. So where do I have to change the code ? Do I have to write a authenticate method in SUF's user.py ? If so: How do I have to do this ??

thanks in advice !
Andy

PS: I'm newbie... don't have any python knowledges...
______________________________________________________________________________
Erster Klick - SMS versenden, zweiter Klick - die Telefonnummer im 
Adressbuch speichern bei: http://freemail.web.de/features/?mc=021151