You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2020/09/08 07:46:16 UTC
[incubator-ponymail-foal] 04/04: drop a note about runners
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit b566735816c91e27375a5a099ec77e946b843ca6
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 8 09:45:59 2020 +0200
drop a note about runners
---
server/plugins/oauthGeneric.py | 1 +
server/plugins/oauthGoogle.py | 1 +
2 files changed, 2 insertions(+)
diff --git a/server/plugins/oauthGeneric.py b/server/plugins/oauthGeneric.py
index fd3ff9d..0676261 100644
--- a/server/plugins/oauthGeneric.py
+++ b/server/plugins/oauthGeneric.py
@@ -9,6 +9,7 @@ async def process(formdata, session, server):
if m:
oauth_domain = m.group(1)
headers = {"User-Agent": "Pony Mail OAuth Agent/0.1"}
+ # This is a synchronous process, so we offload it to an async runner in order to let the main loop continue.
rv = await server.runners.run(requests.post, formdata["oauth_token"], headers=headers, data=formdata)
js = rv.json()
js["oauth_domain"] = oauth_domain
diff --git a/server/plugins/oauthGoogle.py b/server/plugins/oauthGoogle.py
index 153937d..43bed18 100644
--- a/server/plugins/oauthGoogle.py
+++ b/server/plugins/oauthGoogle.py
@@ -15,6 +15,7 @@ import plugins.session
async def process(formdata, session, server: plugins.server.BaseServer):
js = None
request = google.auth.transport.requests.Request()
+ # This is a synchronous process, so we offload it to an async runner in order to let the main loop continue.
id_info = await server.runners.run(
google.oauth2.id_token.verify_oauth2_token,
formdata.get("id_token"),