From f65eb5eeea80adca1cadd3dde421fde030ad2dac Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 11 Sep 2012 20:29:22 -0700 Subject: Add support for Google's X-OAUTH2 SASL mechanism --- sleekxmpp/util/sasl/mechanisms.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sleekxmpp') diff --git a/sleekxmpp/util/sasl/mechanisms.py b/sleekxmpp/util/sasl/mechanisms.py index 5822a6e4..55ae44dd 100644 --- a/sleekxmpp/util/sasl/mechanisms.py +++ b/sleekxmpp/util/sasl/mechanisms.py @@ -123,6 +123,17 @@ class X_MESSENGER_OAUTH2(Mech): return self.credentials['access_token'] +@sasl_mech(10) +class X_OAUTH2(Mech): + + name = 'X-OAUTH2' + required_credentials = set(['username', 'access_token']) + + def process(self, challenge=b''): + return b'\x00' + self.credentials['username'] + \ + b'\x00' + self.credentials['access_token'] + + @sasl_mech(3) class X_GOOGLE_TOKEN(Mech): -- cgit v1.2.3