summaryrefslogtreecommitdiff
path: root/service/pixelated/support
diff options
context:
space:
mode:
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