diff options
author | Yann Leboulanger <asterix@lagaule.org> | 2011-12-19 02:20:30 +0400 |
---|---|---|
committer | Yann Leboulanger <asterix@lagaule.org> | 2011-12-19 02:20:30 +0400 |
commit | 6e4bac262c72018480ac274ceb7a076903f98706 (patch) | |
tree | bf3d73eca59ba67c0c1f536de6c7686e7e641ae3 /src/common/xmpp | |
parent | a1e369dde458fb720557c4389496c3bf33e376f2 (diff) |
implements Oauth2 mechanism to connect to MSN xmpp server. Fixes #6978
Diffstat (limited to 'src/common/xmpp')
-rw-r--r-- | src/common/xmpp/auth_nb.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/common/xmpp/auth_nb.py b/src/common/xmpp/auth_nb.py index dd7d13097..1063ed9a7 100644 --- a/src/common/xmpp/auth_nb.py +++ b/src/common/xmpp/auth_nb.py @@ -264,6 +264,12 @@ class SASL(PlugIn): self._owner._caller.get_password(self.set_password, self.mechanism) self.startsasl = SASL_IN_PROCESS raise NodeProcessed + if 'X-MESSENGER-OAUTH2' in self.mecs: + self.mecs.remove('X-MESSENGER-OAUTH2') + self.mechanism = 'X-MESSENGER-OAUTH2' + self._owner._caller.get_password(self.set_password, self.mechanism) + self.startsasl = SASL_IN_PROCESS + raise NodeProcessed self.startsasl = SASL_FAILURE log.info('I can only use EXTERNAL, SCRAM-SHA-1, DIGEST-MD5, GSSAPI and ' 'PLAIN mecanisms.') @@ -497,6 +503,10 @@ class SASL(PlugIn): '\n', '') node = Node('auth', attrs={'xmlns': NS_SASL, 'mechanism': 'PLAIN'}, payload=[sasl_data]) + elif self.mechanism == 'X-MESSENGER-OAUTH2': + node = Node('auth', attrs={'xmlns': NS_SASL, + 'mechanism': 'X-MESSENGER-OAUTH2'}) + node.addData(password) self._owner.send(str(node)) |