You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2022/01/27 17:15:50 UTC

[incubator-ponymail-foal] 01/02: Add some debug for integration testing

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit a9e7d5852dfb8a1f7c698675c75d71fa1d6df3d6
Author: Sebb <se...@apache.org>
AuthorDate: Thu Jan 27 17:15:27 2022 +0000

    Add some debug for integration testing
---
 server/endpoints/oauth.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/server/endpoints/oauth.py b/server/endpoints/oauth.py
index b2f4bd6..f9ee814 100644
--- a/server/endpoints/oauth.py
+++ b/server/endpoints/oauth.py
@@ -26,11 +26,15 @@ import typing
 import aiohttp.web
 import hashlib
 
+def debug(server, text):
+    if server.api_logger:
+        server.api_logger.debug(text)
 
 async def process(
     server: plugins.server.BaseServer, session: plugins.session.SessionObject, indata: dict,
 ) -> typing.Union[dict, aiohttp.web.Response]:
 
+    debug(server, f"oauth/indata: {indata}")
     key = indata.get("key", "")
     state = indata.get("state")
     code = indata.get("code")
@@ -52,6 +56,7 @@ async def process(
         rv = await plugins.oauthGeneric.process(indata, session, server)
 
     if rv:
+        debug(server, f"oauth/rv: {rv}")
         # Get UID, fall back to using email address
         uid = rv.get("uid")
         if not uid:
@@ -63,6 +68,7 @@ async def process(
             ).hexdigest(16)
             authoritative = oauth_provider in server.config.oauth.authoritative_domains
             admin = authoritative and rv.get("email") in server.config.oauth.admins
+            debug(server, f"oauth/aa: {authoritative} {admin}")
             cookie = await plugins.session.set_session(
                 server,
                 cid,