summary refs log tree commit diff
path: root/synapse/handlers/auth.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-02-17 16:50:59 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-02-17 16:50:59 +0000
commitade1224b844525a233c902c5984f587463b3807d (patch)
treeaa0a385dde5888792a65a265761272365982a084 /synapse/handlers/auth.py
parentMerge pull request #5658 from matrix-org/babolivier/is-json (diff)
parentInline issue_access_token (#5659) (diff)
downloadsynapse-ade1224b844525a233c902c5984f587463b3807d.tar.xz
Inline issue_access_token (#5659)
Diffstat (limited to 'synapse/handlers/auth.py')
-rw-r--r--synapse/handlers/auth.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py
index 3320cbec71..8c662f8528 100644
--- a/synapse/handlers/auth.py
+++ b/synapse/handlers/auth.py
@@ -578,9 +578,11 @@ class AuthHandler(BaseHandler):
             StoreError if there was a problem storing the token.
         """
         logger.info("Logging in user %s on device %s", user_id, device_id)
-        access_token = yield self.issue_access_token(user_id, device_id)
         yield self.auth.check_auth_blocking(user_id)
 
+        access_token = self.macaroon_gen.generate_access_token(user_id)
+        yield self.store.add_access_token_to_user(user_id, access_token, device_id)
+
         # the device *should* have been registered before we got here; however,
         # it's possible we raced against a DELETE operation. The thing we
         # really don't want is active access_tokens without a record of the
@@ -832,12 +834,6 @@ class AuthHandler(BaseHandler):
         defer.returnValue(user_id)
 
     @defer.inlineCallbacks
-    def issue_access_token(self, user_id, device_id=None):
-        access_token = self.macaroon_gen.generate_access_token(user_id)
-        yield self.store.add_access_token_to_user(user_id, access_token, device_id)
-        defer.returnValue(access_token)
-
-    @defer.inlineCallbacks
     def validate_short_term_login_token_and_get_user_id(self, login_token):
         auth_api = self.hs.get_auth()
         user_id = None