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 13:02:28 UTC

[incubator-ponymail-foal] branch master updated (8e6b914 -> 9762142)

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

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


    from 8e6b914  Bump server version
     new ec41a74  Add constant for magic string 'generic'
     new ea53571  Trailing spaces
     new 9762142  Bump server version

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 server/endpoints/oauth.py | 2 +-
 server/main.py            | 2 +-
 server/plugins/session.py | 7 ++++---
 server/server_version.py  | 2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)

[incubator-ponymail-foal] 01/03: Add constant for magic string 'generic'

Posted by se...@apache.org.
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 ec41a7411c419c68d98278ed53140ca1e4d7736a
Author: Sebb <se...@apache.org>
AuthorDate: Thu Jan 27 13:00:06 2022 +0000

    Add constant for magic string 'generic'
---
 server/endpoints/oauth.py | 2 +-
 server/plugins/session.py | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/server/endpoints/oauth.py b/server/endpoints/oauth.py
index 8e18e2f..b2f4bd6 100644
--- a/server/endpoints/oauth.py
+++ b/server/endpoints/oauth.py
@@ -57,7 +57,7 @@ async def process(
         if not uid:
             uid = rv.get("email")
         if uid:
-            oauth_provider = rv.get("oauth_domain", "generic")
+            oauth_provider = rv.get("oauth_domain", plugins.session.OAUTH_PROVIDER_DEFAULT)
             cid = hashlib.shake_128(
                 ("%s-%s" % (oauth_provider, uid)).encode("ascii", "ignore")
             ).hexdigest(16)
diff --git a/server/plugins/session.py b/server/plugins/session.py
index 433fd5b..e08cdc0 100644
--- a/server/plugins/session.py
+++ b/server/plugins/session.py
@@ -31,6 +31,7 @@ import copy
 FOAL_MAX_SESSION_AGE = 86400 * 7  # Max 1 week between visits before voiding a session
 FOAL_SAVE_SESSION_INTERVAL = 3600  # Update sessions on disk max once per hour
 DATABASE_NOT_CONNECTED = "Database not connected!"
+OAUTH_PROVIDER_DEFAULT = "generic"
 
 class SessionCredentials:
     uid: str
@@ -46,7 +47,7 @@ class SessionCredentials:
             self.uid = doc.get("uid", "")
             self.name = doc.get("name", "")
             self.email = doc.get("email", "")
-            self.oauth_provider = doc.get("oauth_provider", "generic")
+            self.oauth_provider = doc.get("oauth_provider", OAUTH_PROVIDER_DEFAULT)
             self.authoritative = doc.get("authoritative", False)
             self.admin = doc.get("admin", False)
             self.oauth_data = doc.get("oauth_data", {})
@@ -54,7 +55,7 @@ class SessionCredentials:
             self.uid = ""
             self.name = ""
             self.email = ""
-            self.oauth_provider = "generic"
+            self.oauth_provider = OAUTH_PROVIDER_DEFAULT
             self.authoritative = False
             self.admin = False
             self.oauth_data = {}
@@ -164,7 +165,7 @@ async def get_session(
                     internal.get("oauth_provider")
                     in server.config.oauth.authoritative_domains
                 )
-                creds["oauth_provider"] = internal.get("oauth_provider", "generic")
+                creds["oauth_provider"] = internal.get("oauth_provider", OAUTH_PROVIDER_DEFAULT)
                 creds["oauth_data"] = internal.get("oauth_data", {})
                 # We update admin boolean whenever we fetch session doc, as they may have changed in yaml but not in ES.
                 creds["admin"] = creds["authoritative"] and creds.get('email') in server.config.oauth.admins

[incubator-ponymail-foal] 03/03: Bump server version

Posted by se...@apache.org.
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 9762142f5013c3134d92a3588547b1cd5a473d71
Author: Sebb <se...@apache.org>
AuthorDate: Thu Jan 27 13:02:13 2022 +0000

    Bump server version
---
 server/server_version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/server_version.py b/server/server_version.py
index 19de329..eb0eb62 100644
--- a/server/server_version.py
+++ b/server/server_version.py
@@ -1,2 +1,2 @@
 # This file is generated by server/update_version.sh
-PONYMAIL_SERVER_VERSION = '3547035'
+PONYMAIL_SERVER_VERSION = 'ea53571'

[incubator-ponymail-foal] 02/03: Trailing spaces

Posted by se...@apache.org.
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 ea53571d942ed12245fbdfd78b33a95cf683cfd0
Author: Sebb <se...@apache.org>
AuthorDate: Thu Jan 27 13:01:30 2022 +0000

    Trailing spaces
---
 server/main.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/main.py b/server/main.py
index a18e06b..522756a 100644
--- a/server/main.py
+++ b/server/main.py
@@ -107,7 +107,7 @@ class Server(plugins.server.BaseServer):
             self.api_logger.setLevel(args.apilog)
             self.api_logger.addHandler(logging.StreamHandler())
         self.stoppable = args.stoppable
-        self.refreshable = args.refreshable            
+        self.refreshable = args.refreshable
 
     async def handle_request(
         self, request: aiohttp.web.BaseRequest