summaryrefslogtreecommitdiff
path: root/service/pixelated/support/ext_shared_db.py
blob: 83c09ddc027fbc6e4f93fa6a650cc766376d1ab4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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