summaryrefslogtreecommitdiff
path: root/service/pixelated/support
diff options
context:
space:
mode:
authorJefferson Stachelski <jefferson.stachelski@gmail.com>2015-06-04 17:00:25 -0300
committerJefferson Stachelski <jefferson.stachelski@gmail.com>2015-06-04 17:00:40 -0300
commitec236d313359f319e99789a8cc3eb002c5b2288a (patch)
tree7c1daceddc35c1aa3c47c110e21d3e77cce2dbe9 /service/pixelated/support
parentaccf8a1fe1d854417b705f37202bb1fe61cdcbe1 (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.py15
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