[Twisted-Python] cred question
Michele Petrazzo
michele.petrazzo at unipex.it
Thu Nov 23 11:38:18 MST 2006
Hi,
I'm trying to use the various checkers.* that implement the
ICredentialsChecker, for authenticate a spread.pb client, but I have a
lot of problem with all the checkers except the
InMemoryUsernamePasswordDatabaseDontUse (and FilePasswordDB without hash
function) that work.
The output message are:
"""Failure: twisted.cred.error.UnhandledCredentials: No checker for
twisted.cred.credentials.IUsernameHashedPassword,
twisted.spread.pb.IUsernameMD5Password, twisted.spread.interfaces.IJellyable
"""
My server code:
<code>
class MyRealm:
__implements__ = portal.IRealm
def requestAvatar(self, avatarId, mind, *interfaces):
if pb.IPerspective not in interfaces:
raise NotImplementedError
return pb.IPerspective, MyPerspective(avatarId), lambda:None
class MyPerspective(pb.Avatar):
def __init__(self, name):
self.name = name
print "\n\nServer: New connection: %s"%name
p = portal.Portal(MyRealm())
c = checkers.InMemoryUsernamePasswordDatabaseDontUse(user2="pass2")
#or c = checkers.FilePasswordDB("passwd") that work
#or c = checkers.FilePasswordDB("passwd", hash=hash_funct) that don't
#work
#or c = checkers.AllowAnonymousAccess()
p.registerChecker(c)
reactor.listenTCP(8800, pb.PBServerFactory(p))
reactor.run()
</code>
How can I use the various FilePasswordDB with the hash or the others?
Thanks,
Michele
More information about the Twisted-Python
mailing list