diff options
author | Jefferson Stachelski <jefferson.stachelski@gmail.com> | 2015-06-04 17:00:25 -0300 |
---|---|---|
committer | Jefferson Stachelski <jefferson.stachelski@gmail.com> | 2015-06-04 17:00:40 -0300 |
commit | ec236d313359f319e99789a8cc3eb002c5b2288a (patch) | |
tree | 7c1daceddc35c1aa3c47c110e21d3e77cce2dbe9 /service/pixelated/support | |
parent | accf8a1fe1d854417b705f37202bb1fe61cdcbe1 (diff) |
#406 Monkey patched the _sign_request method from soledad client shared_db
Diffstat (limited to 'service/pixelated/support')
-rw-r--r-- | service/pixelated/support/ext_shared_db.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/service/pixelated/support/ext_shared_db.py b/service/pixelated/support/ext_shared_db.py new file mode 100644 index 00000000..83c09ddc --- /dev/null +++ b/service/pixelated/support/ext_shared_db.py @@ -0,0 +1,15 @@ +from leap.soledad.client.auth import TokenBasedAuth +import base64 + + +def patched_sign_request(self, method, url_query, params): + if 'token' in self._creds: + uuid, token = self._creds['token'] + auth = '%s:%s' % (uuid, token) + return [('Authorization', 'Token %s' % base64.b64encode(auth))] + else: + raise errors.UnknownAuthMethod( + 'Wrong credentials: %s' % self._creds) + + +TokenBasedAuth._sign_request = patched_sign_request |