[Twisted-Python] Something strange about cred

Stephen Waterbury stephen.c.waterbury at nasa.gov
Wed Feb 7 09:18:21 MST 2007


I think I've found the problem with trying to use my UserDbCredChecker
with the web2 auth example.  [The reason I'm posting this to the
twisted list rather than twisted-web is because I think it points to
a possible problem with cred (or at least some confusing names), which
is not specifically web.]

I believe the problem is with ICredentials.  Its interface
docstring says "I check credentials." -- first of all, this is
counter-intuitive to me.  IMO should either say "I *am* credentials",
or else the interface should be "ICredentialsChecker" -- i.e.,
I think the checkPassword method it specifies should be provided by
the ICredentialsChecker (if it is needed at all -- questionable).

IMO ICredentials subinterfaces should only specify the types
of credentials that are being provided (e.g., attributes username
and password, for IUsernamePassword), and the checkPassword method
should be in the ICredentialsChecker interface (and might not need
to be public anyway -- all that needs to be public is
requestAvatarId, really).

Getting back to the web2 auth example, it appears that the checker's
requestAvatarId method receives an ICredentials provider as its
parameter, and my assumption was that the ICredentials provider would
have attributes 'username' and 'password' -- which the IUsernamePassword
interface docstring specifies as ivars (which I believe is incorrect
syntax for a zope.interface definition -- I think they should be
Attributes if they are supposed to be part of the interface
specification) -- but I'm not sure it's getting them, because I think
if it did my checker would work (i.e., would return an AvatarId (the
username) from its requestAvatarId method).

Comments?

Steve




More information about the Twisted-Python mailing list