summary refs log tree commit diff
path: root/synapse/handlers/auth.py
diff options
context:
space:
mode:
authorNegi Fazeli <negar.fazeli@ericsson.com>2016-04-20 16:21:40 +0200
committerNegar Fazeli <negar.fazeli@ericsson.com>2016-05-13 15:34:15 +0200
commit40aa6e8349b348802d6f87084c31c3895f728708 (patch)
tree2150d48917b62e0317a73e7892061d73e2fe62ec /synapse/handlers/auth.py
parentPass through _get_state_group_for_events (diff)
downloadsynapse-40aa6e8349b348802d6f87084c31c3895f728708.tar.xz
Create user with expiry
 - Add unittests for client, api and handler

Signed-off-by: Negar Fazeli <negar.fazeli@ericsson.com>
Diffstat (limited to 'synapse/handlers/auth.py')
-rw-r--r--synapse/handlers/auth.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py
index 61fe56032a..3d36d3460e 100644
--- a/synapse/handlers/auth.py
+++ b/synapse/handlers/auth.py
@@ -521,11 +521,11 @@ class AuthHandler(BaseHandler):
         ))
         return m.serialize()
 
-    def generate_short_term_login_token(self, user_id):
+    def generate_short_term_login_token(self, user_id, duration_in_ms=(2 * 60 * 1000)):
         macaroon = self._generate_base_macaroon(user_id)
         macaroon.add_first_party_caveat("type = login")
         now = self.hs.get_clock().time_msec()
-        expiry = now + (2 * 60 * 1000)
+        expiry = now + duration_in_ms
         macaroon.add_first_party_caveat("time < %d" % (expiry,))
         return macaroon.serialize()