summary refs log tree commit diff
path: root/synapse/rest/client/v2_alpha/openid.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-12-05 16:46:37 +0000
committerErik Johnston <erik@matrix.org>2019-12-05 16:56:23 +0000
commit9c41ba4c5fe6e554bc885a1bef8ed51d14ec0f3e (patch)
tree7cf412d3be90fb978f46f8cda68ef210d3d6f7de /synapse/rest/client/v2_alpha/openid.py
parentMerge pull request #6482 from matrix-org/erikj/port_rest_v1 (diff)
downloadsynapse-9c41ba4c5fe6e554bc885a1bef8ed51d14ec0f3e.tar.xz
Port rest.client.v2
Diffstat (limited to 'synapse/rest/client/v2_alpha/openid.py')
-rw-r--r--synapse/rest/client/v2_alpha/openid.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/synapse/rest/client/v2_alpha/openid.py b/synapse/rest/client/v2_alpha/openid.py
index b4925c0f59..6ae9a5a8e9 100644
--- a/synapse/rest/client/v2_alpha/openid.py
+++ b/synapse/rest/client/v2_alpha/openid.py
@@ -16,8 +16,6 @@
 
 import logging
 
-from twisted.internet import defer
-
 from synapse.api.errors import AuthError
 from synapse.http.servlet import RestServlet, parse_json_object_from_request
 from synapse.util.stringutils import random_string
@@ -68,9 +66,8 @@ class IdTokenServlet(RestServlet):
         self.clock = hs.get_clock()
         self.server_name = hs.config.server_name
 
-    @defer.inlineCallbacks
-    def on_POST(self, request, user_id):
-        requester = yield self.auth.get_user_by_req(request)
+    async def on_POST(self, request, user_id):
+        requester = await self.auth.get_user_by_req(request)
         if user_id != requester.user.to_string():
             raise AuthError(403, "Cannot request tokens for other users.")
 
@@ -81,7 +78,7 @@ class IdTokenServlet(RestServlet):
         token = random_string(24)
         ts_valid_until_ms = self.clock.time_msec() + self.EXPIRES_MS
 
-        yield self.store.insert_open_id_token(token, ts_valid_until_ms, user_id)
+        await self.store.insert_open_id_token(token, ts_valid_until_ms, user_id)
 
         return (
             200,