[Twisted-Python] Must avatarId always be a string?
glyph at twistedmatrix.com
Wed Jan 9 13:02:53 EST 2013
On Jan 9, 2013, at 9:26 AM, Peter Westlake <peter.westlake at pobox.com> wrote:
>> I am not an expert in Twisted, but from my understanding, the "string"
>> requirement is there to provide a plugable interface. So that you can
>> have generic credentials checkers, working with generic realms.
>> Having simple "strings" could also help with AvatarId serialization,
>> in case you have the CredentialsChecker on one computer and the you
>> will pass them over network/socket to a remote Realm.
> Those are both good points! I'll leave it this way until there's
> a more official way of doing it.
I hope it's clear that just hard-coding your avatars and realms to work only with each other is a sub-optimal solution :).
The architecture of cred is supposed to be that you can plug realms and checkers together so that a change to your authentication backend doesn't completely change your application. Of course, that architecture is flawed in the sense that a string is a bit too narrow of a communication channel to get information about the authenticated user from one to the other, especially in cases where the application needs information from a directory service to function.
If you're interested in an improved, official way to deal with this use-case, the best way to do that would be to get involved and actively try to specify what you need. I've got similar use-cases at work, as you can see here: <http://trac.calendarserver.org/browser/CalendarServer/trunk/twistedcaldav/directory/idirectory.py> so I'd be happy to talk to you about some ideas.
The best way to predict the future is to invent it. :)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python