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

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

Reply via email to