[Twisted-Python] Must avatarId always be a string?

Adi Roiban adi at roiban.ro
Wed Jan 9 09:40:26 EST 2013


On 9 January 2013 15:04, Jan Urbański <wulczer at wulczer.org> wrote:
> On 09/01/13 13:49, Peter Westlake wrote:
>> http://twistedmatrix.com/documents/current/core/howto/cred.html says
>> that the avatarId parameter to IRealm.requestAvatar must be a string,
>> not even a Unicode string. I'm using LDAP for authentication, and the
>> checker retrieves the full LDAP entry for the user as a side-effect of
>> authentication.
>
> I remember discussing this on IRC with someone not long ago and he
> pointed me to this thread:
>
> http://twistedmatrix.com/pipermail/twisted-python/2010-September/022826.html
>
> I have faced a similar problem myself and after reading the code I've
> resolved to wilfully disregarding the documentation and passing tuples
> around, accepting that if it breaks, I get to keep both pieces.

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.

I have also asked over IRC and I got the good to go answer for using
anything as AvatarID.

As long as you are only using your custom credentials checkers and
your custom realm, everything should be ok.

I am using Objects as AvatarID without any problems.

Cheers,
-- 
Adi Roiban



More information about the Twisted-Python mailing list