[Twisted-Python] PB and Woven authentication
justinjohnson at fastmail.fm
Tue Oct 7 09:49:44 EDT 2003
I know there have been other posts on this topic, but I wasn't sure how
up-to-date they are.
I currently have a PB server that I connect to via the command line. It
allows me to do tasks on wintel servers I manage. I'm now trying to
create a web interface to that service using woven.
Below is what I'm currently doing for authentication.
First of all, am I doing things right below? Any corrections or
suggestions for improvement?
Once that is correct, how do I hook this up to woven? I was trying to
look through the Quotient code to figure it out, but there is so much
other stuff in there I'm having a hard time keeping it all straight.
***** SERVER SIDE *****
self.p = RatControlPerspective("admin")
def requestAvatar(self, avatarId, mind, interface):
assert interface == pb.IPerspective
assert mind == "BRAINS!"
self.p.loggedIn = 1
return pb.IPerspective, self.p, self.p.logout
from twisted.cred import portal, checkers, credentials
realm = RatControlRealm()
portal = portal.Portal(realm)
checker = checkers.InMemoryUsernamePasswordDatabaseDontUse()
factory = pb.PBServerFactory(portal)
***** CLIENT SIDE *****
def connectToServer(self, server):
print "Failed to connect to '%s'." % server
factory = pb.PBClientFactory()
reactor.connectTCP(server, config.portNumber, factory)
d = factory.login(credentials.UsernamePassword(config.adminUser,
More information about the Twisted-Python