summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2013-04-30 17:25:43 -0300
committerdrebs <drebs@leap.se>2013-04-30 17:25:43 -0300
commit1e9b0e85a5de03f399c0cf52f46458dc6e77e103 (patch)
treef5689ba291acb412e7bd77872d59764a06cc7953
parent703223a4f32d762a27ae8bc66cba15eb6be64006 (diff)
Add docstrings to auth methods.
-rw-r--r--src/leap/soledad/auth.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/leap/soledad/auth.py b/src/leap/soledad/auth.py
index 35f4700f..094278dc 100644
--- a/src/leap/soledad/auth.py
+++ b/src/leap/soledad/auth.py
@@ -18,6 +18,9 @@
"""
Methods for token-based authentication.
+
+These methods have to be included in all classes that extend HTTPClient so
+they can do token-based auth requests to the Soledad server.
"""
@@ -25,10 +28,28 @@ from u1db.remote.http_client import HTTPClientBase
def set_token_credentials(self, address, token):
+ """
+ Store given credentials so we can sign the request later.
+
+ @param address: The user's address.
+ @type address: str
+ @param token: The authentication token.
+ @type token: str
+ """
self._creds = {'token': (address, token)}
def _sign_request(self, method, url_query, params):
+ """
+ Return an authorization header to be included in the HTTP request.
+
+ @param method: The HTTP method.
+ @type method: str
+ @param url_query: The URL query string.
+ @type url_query: str
+ @param params: A list with encoded query parameters.
+ @type param: list
+ """
if 'token' in self._creds:
address, token = self._creds['token']
auth = '%s:%s' % (address, token)