summary refs log tree commit diff
path: root/synapse/handlers/auth.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-05-13 14:46:53 +0100
committerErik Johnston <erik@matrix.org>2016-05-13 14:46:53 +0100
commit99b5a2e560d28894710e1bebaa1977cfebc7963d (patch)
tree88e0f3de599addc0a129d3c94212aef674c5c24d /synapse/handlers/auth.py
parentMerge pull request #778 from matrix-org/erikj/add_pusher (diff)
parentCreate user with expiry (diff)
downloadsynapse-99b5a2e560d28894710e1bebaa1977cfebc7963d.tar.xz
Merge pull request #741 from negzi/create_user_with_expiry
Create user with expiry
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 6e7d080ecc..68d0d78fc6 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()