summaryrefslogtreecommitdiff
path: root/service/pixelated/extensions/shared_db.py
blob: b433dd50791746094bdeaf4b3f9bb674a9ecc84f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from leap.soledad.client.auth import TokenBasedAuth
import base64
from u1db import errors


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