[Twisted-Python] Foolscap-0.0.7 (aka newpb) released

Brian Warner warner at lothar.com
Sat Jan 27 16:33:54 EST 2007


>> Foolscap is a next-generation RPC protocol for Twisted, under development as
>> "newpb" for the last several years. It is intended to eventually replace PB,
>> but it is not yet ready for production use.

> Hi Brian,
> What are your plans for client-sever authentication with Foolscap?  I checked
> out the README and it made no mention of that capability yet.

I'm afraid I don't understand what you mean by "client-server
authentication".. can you expand upon that?

If what you want is a way to send a username/password to a server and have it
connect you to some resource based upon the validity of that pair, then it's
trivial to publish some sort of "login" object that has a method which
accepts that pair, and then does a lookup/verification and returns some sort
of avatar for that user, something like this:
  
  class Avatar(foolscap.Referenceable):
    def __init__(self, user_object):
        self.user_object = user_object
    def remote_stuff(self, args):
        return self.user_object.stuff(args)
  
  class Login(foolscap.Referenceable):
    def remote_login(self, username, password):
        if username in self.passwords and self.passwords[username] == password:
            return Avatar(self.user_objects[username])
        raise BadPasswordOrUnknownUserError()
  
  t = foolscap.Tub()
  pburl = t.registerReference(Login())
  print "connect your client to %s" % pburl

I haven't put a great deal of thought into how twisted.cred should be used in
conjunction with Foolscap, but my hunch is that it should just be a layer on
top, with some sort of convention for indicating what form of credentials the
client is offering.

cheers,
 -Brian





More information about the Twisted-Python mailing list