[Zope-dev] zope.password SSHAPasswordManager cannot handle unicode?
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Tue May 25 10:58:39 EDT 2010
Hi,
When I define a principal in my site.zcml and have it use the
SSHAPasswordManager, I cannot login as a "TypeError: character mapping
must return integer, None or unicode" is raised in the checkPassword()
methid. It took me quite a while to figure out what was going on...
The site.zcml contains the encoded password for the principal that will
be "contained" in the global principalregistry. When trying to login,
the encoded password is taken from the principal object created from the
information in site.zcml, and it makes sense that the encoded password
will be an unicode string.
However the checkPassword() method of the SSHAPasswordManager cannot
handle unicode or, more specifically, it will call
base64.urlsafe_b64decode() on it that cannot handle unicode strings (or
at least not in this case).
I my assesment is correct, then I must conclude no one is using the
SSHAPasswordManager? But maybe there's something I don't understand
about what is going wrong here...
Anyway, I guess I could fix this by have the encoded password encoded to
ascii first before passing it to uurlsafe_b64decode. I think this would
be safe, as the encoded password would not contain non-ascii characters
anyway, right?
regards, jw
More information about the Zope-Dev
mailing list