-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert (Jamie) Munro wrote:
> How do you use md5 passwords in PAS?
> 
> I've got an SQL database already populated with usernames and md5
> passwords from an old system that I am replacing - I don't have the
> cleartext passwords.

You write an authentication plugin which takes the credentials as keys
in a dict (e.g., 'login_name', 'password'), encrypts the password using
the same algorithm as your old system, and then compares them.  E.g.,
(untested)::

  import md5
  PASSWORD_TEST_SQL = ("select * from users where login_name = '%s' "
                       "and encrypted_pw = '%s'")
  def authenticateCredentials(self, credentials):
      login = credentials['login']
      clear = credentials['password']
      encrypted = md5.new(clear).hexdigest() # or whatever
      matched = self._execSQL(PASSWORD_TEST_SQL % (login, encrypted))
      if matched:
         return matched[0]['userid'], login
      return {}


Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFK8mt+gerLs4ltQ4RAsfdAJ9WVfYSFdVKoJLpE66WXDwi6+ssqgCg0yGz
EEMHjFMrCdq0hjcWIhySnXY=
=7L1E
-----END PGP SIGNATURE-----

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to