[Twisted-Python] Twisted Cred using network connections to check credentials

Devin Jeanpierre jeanpierreda at gmail.com
Tue Feb 22 09:28:39 MST 2011


Thank you very much!

Devin Jeanpierre

On Tue, Feb 22, 2011 at 11:02 AM, <exarkun at twistedmatrix.com> wrote:

> On 03:46 pm, jeanpierreda at gmail.com wrote:
> >Hello,
> >
> >I want to authenticate a user in twisted.cred by attempting to log him
> >in to
> >an online service. If the authentication step of the connection fails,
> >the
> >user gets no avatar, and if it succeeds, the user gets an avatar, and
> >that
> >avatar either is or has a reference to that connection.
> >
> >How would I do this? I can think of two ugly ways: I can use a global
> >dictionary mapping avatarIds to protocol instances, and do a lookup on
> >that
> >dict in the Realm to create the avatar. Otherwise, I can instantiate
> >the
> >connection as part of the credentials, and keep the reference to it
> >around
> >when I get the avatar. I'm going ahead with the former, but it's scary.
> >
> >Another possibility is that perhaps the credentials checker and the
> >realm
> >could be the same object, and then I could move the global dict into an
> >attribute. Would that be a better approach?
>
> You can do this, but you don't have to.  You can also pass the dict to
> both the checker initializer and the realm initializer.  Now they both
> have a reference to it, but it's not global, and they're still separate
> objects.
>
> Jean-Paul
> >The background for this is that I have an implementation of the chat
> >part of
> >the Direct Connect (DC) protocol, and want to write an IRC<->DC bridge.
> >I
> >chose twisted.words.services on the recommendation of someone, which
> >uses
> >Cred for auth. DC has authentication as a given nick as part of the
> >"handshake" during the start of the connection attempt.
> >
> >Devin Jeanpierre
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20110222/6a91b3fc/attachment.html>


More information about the Twisted-Python mailing list