[Twisted-Python] multiple log-in / perspective broker

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Sat Jan 11 13:59:56 MST 2014


On 08:46 pm, sank.daniel at gmail.com wrote:
>>In other words, you don't have to log in on the *root* pb object. 
>>Loginis just
>>a PB method call.  You can have a second portal wrapping a different 
>>realm
>>handing out different avatars and you can log in to that portal the
>second time.
>
>I look in t.s.pb to find out what methods are called during log in.
>PBServerFactory is adapted to a pb root object by _PortalRoot which 
>returns
>a _PortalWrapper from rootObject(self, broker).
>
>_PortalWrapper has a remote_login method with the following code
>
>def remote_login(self, username):
>        """
>        Start of username/password login.
>        """
>        c = challenge()
>        return c, _PortalAuthChallenger(self.portal, self.broker, 
>username,
>c)
>
>I'm confused by this because I expect that attempting to return an 
>instance
>of _PortalAuthChallenger from the remote_login method should fail (ie.
>insecureJelly). How does this work?

_PortalAuthChallenger is a Referenceable.  Any Referenceable is allowed 
by default.

See twisted.spread.jelly.SecurityOptions, in particular the `basicTypes` 
attribute and the `allowBasicTypes` method.

Jean-Paul



More information about the Twisted-Python mailing list