summaryrefslogtreecommitdiff
path: root/sleekxmpp/features/feature_mechanisms
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-01-20 01:08:25 -0800
committerLance Stout <lancestout@gmail.com>2012-01-20 01:08:25 -0800
commit0d2125e737d28c8cf8aad0fd80b72179b8e7b914 (patch)
treee5eb0ec70adc71c8a0a1f79cf56437f2322d47a8 /sleekxmpp/features/feature_mechanisms
parent02f400615334806fc531c149d85fe6f9a06d3e1e (diff)
downloadslixmpp-0d2125e737d28c8cf8aad0fd80b72179b8e7b914.tar.gz
slixmpp-0d2125e737d28c8cf8aad0fd80b72179b8e7b914.tar.bz2
slixmpp-0d2125e737d28c8cf8aad0fd80b72179b8e7b914.tar.xz
slixmpp-0d2125e737d28c8cf8aad0fd80b72179b8e7b914.zip
Add an extra config dict to store SASL credentials.
We'll need extra things beyond just a password, such as api_key.
Diffstat (limited to 'sleekxmpp/features/feature_mechanisms')
-rw-r--r--sleekxmpp/features/feature_mechanisms/mechanisms.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/sleekxmpp/features/feature_mechanisms/mechanisms.py b/sleekxmpp/features/feature_mechanisms/mechanisms.py
index deff5d30..1148f06a 100644
--- a/sleekxmpp/features/feature_mechanisms/mechanisms.py
+++ b/sleekxmpp/features/feature_mechanisms/mechanisms.py
@@ -35,12 +35,18 @@ class feature_mechanisms(base_plugin):
return 'starttls' in self.xmpp.features
def basic_callback(mech, values):
- if 'username' in values:
- values['username'] = self.xmpp.boundjid.user
- if 'password' in values:
- values['password'] = self.xmpp.password
- if 'access_token' in values:
- values['access_token'] = self.xmpp.password
+ for value in values:
+ if value == 'username':
+ values['username'] = self.xmpp.boundjid.user
+ elif value == 'password':
+ values['password'] = self.xmpp.credentials['password']
+ elif value == 'access_token':
+ if 'access_token' in self.xmpp.credentials:
+ values['access_token'] = self.xmpp.credentials['access_token']
+ else:
+ values['access_token'] = self.xmpp.credentials['password']
+ elif value in self.xmpp.credentials:
+ values[value] = self.xmpp.credentials[value]
mech.fulfill(values)
sasl_callback = self.config.get('sasl_callback', None)