summaryrefslogtreecommitdiff
path: root/sleekxmpp/util/sasl/mechanisms.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-09-11 20:29:22 -0700
committerLance Stout <lancestout@gmail.com>2012-09-11 20:29:22 -0700
commitf65eb5eeea80adca1cadd3dde421fde030ad2dac (patch)
treee41be072a4f94b225887b2f43c25ba3028ea6182 /sleekxmpp/util/sasl/mechanisms.py
parent26fa9bd87e1c722c442bb793c77a4eeb649998c7 (diff)
downloadslixmpp-f65eb5eeea80adca1cadd3dde421fde030ad2dac.tar.gz
slixmpp-f65eb5eeea80adca1cadd3dde421fde030ad2dac.tar.bz2
slixmpp-f65eb5eeea80adca1cadd3dde421fde030ad2dac.tar.xz
slixmpp-f65eb5eeea80adca1cadd3dde421fde030ad2dac.zip
Add support for Google's X-OAUTH2 SASL mechanism
Diffstat (limited to 'sleekxmpp/util/sasl/mechanisms.py')
-rw-r--r--sleekxmpp/util/sasl/mechanisms.py11
1 files changed, 11 insertions, 0 deletions
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):