[Twisted-Python] Re: Perspective Broker Anonymous access..

exarkun at divmod.com exarkun at divmod.com
Fri Dec 8 13:43:40 MST 2006


On 08:19 pm, cedepaula at yahoo.com.br wrote:
>Jean-Paul Calderone <exarkun <at> divmod.com> writes:
>
>>
>> You have to re-implement the login process to support anonymous users.
>>
>> PBClientFactory.login() cannot be used for this.
>>
>> Jean-Paul
>>
>
>So, the examples given in
>http://twistedmatrix.com/projects/core/documentation/howto/pb-cred.html (below)
>doesnt works?
>
># anonymous users share one Avatar, named users each get their own
>    def requestAvatar(self, avatarID, mind, *interfaces):
>        assert pb.IPerspective in interfaces
>        if avatarID == checkers.ANONYMOUS:
>            return pb.IPerspective, self.anonAvatar, lambda:None
>        else:
>            return pb.IPerspective, self.avatars[avatarID], lambda:None

Yes, unfortunately.  Without changing protocol-level code in PB, there is
no way the first branch in that if/else is ever going to be executed. I'm
not sure why the example bothers to cover this case; it seems misleading.

>
>I was looking at pb.py, portal.py and the way i understood, the whole chain
>(login -> cbSendUsername -> remote login -> cb_Response -> remote respond) is
>the responsible by the login process... if we send like credentials.Anonymous in
>login(), all this chain needs to handle it... right?

Yes, that is correct.  Despite the number of steps involved, it's actually
not very much work to adjust.

>
>Its a little strange why we cant have authenticated and anonymous users sharing
>the same process since we can filter in the avatar given the permissions (like
>example above).

It's an unfortunate omission.  Requests for PB logins using a different
kind of credentials object are fairly common.

>
>Another question... is it interesting to twisted project to have this kind of
>support? I mean, is it important to provide a way to this support in a patch to
>the project or should I do modifications I need (if i learn how to) and keep
>them to me?

It would be a very welcome contribution. :)  Take a look at these pages,
if you haven't already seen them, for some guidelines on how to best
contribute the changes, and feel free to ask if you have any other questions.

Jean-Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20061208/fcf1d6d9/attachment.html>


More information about the Twisted-Python mailing list