diff options
author | Lance Stout <lancestout@gmail.com> | 2012-07-29 17:22:16 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-07-30 19:15:10 -0700 |
commit | 695cd95657585006a696243a1c8249f9d90b506e (patch) | |
tree | 3f4b4ff419b2cba9970da78b84b1b7bb059a3a9a /sleekxmpp/thirdparty/suelta/mechanisms/plain.py | |
parent | e4b4c676379df30d268d28341b643cd9cd10eb22 (diff) | |
download | slixmpp-695cd95657585006a696243a1c8249f9d90b506e.tar.gz slixmpp-695cd95657585006a696243a1c8249f9d90b506e.tar.bz2 slixmpp-695cd95657585006a696243a1c8249f9d90b506e.tar.xz slixmpp-695cd95657585006a696243a1c8249f9d90b506e.zip |
Update and integrate Suelta.
Diffstat (limited to 'sleekxmpp/thirdparty/suelta/mechanisms/plain.py')
-rw-r--r-- | sleekxmpp/thirdparty/suelta/mechanisms/plain.py | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/sleekxmpp/thirdparty/suelta/mechanisms/plain.py b/sleekxmpp/thirdparty/suelta/mechanisms/plain.py deleted file mode 100644 index accae54a..00000000 --- a/sleekxmpp/thirdparty/suelta/mechanisms/plain.py +++ /dev/null @@ -1,61 +0,0 @@ -import sys - -from sleekxmpp.thirdparty.suelta.util import bytes -from sleekxmpp.thirdparty.suelta.sasl import Mechanism, register_mechanism -from sleekxmpp.thirdparty.suelta.exceptions import SASLError, SASLCancelled - - -class PLAIN(Mechanism): - - """ - """ - - def __init__(self, sasl, name): - """ - """ - super(PLAIN, self).__init__(sasl, name) - - if not self.sasl.tls_active(): - if not self.sasl.sec_query(self, '-ENCRYPTION, PLAIN'): - raise SASLCancelled(self.sasl, self) - else: - if not self.sasl.sec_query(self, '+ENCRYPTION, PLAIN'): - raise SASLCancelled(self.sasl, self) - - self.check_values(['username', 'password']) - - def prep(self): - """ - Prepare for processing by deleting the password if - the user has not approved storing it in the clear. - """ - if 'savepass' not in self.values: - if self.sasl.sec_query(self, 'CLEAR-PASSWORD'): - self.values['savepass'] = True - - if 'savepass' not in self.values: - del self.values['password'] - - return True - - def process(self, challenge=None): - """ - Process a challenge request and return the response. - - :param challenge: A challenge issued by the server that - must be answered for authentication. - """ - user = bytes(self.values['username']) - password = bytes(self.values['password']) - return b'\x00' + user + b'\x00' + password - - def okay(self): - """ - Mutual authentication is not supported by PLAIN. - - :returns: ``True`` - """ - return True - - -register_mechanism('PLAIN', 5, PLAIN, use_hashes=False) |