public inbox for [email protected]  
help / color / mirror / Atom feed
From: Rahul Shirsat <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [patch][pgAdmin4] RM6832 oauth2 + internal authentication failure when order is changed in config file
Date: Wed, 10 Nov 2021 17:40:39 +0530
Message-ID: <CAKtn9dNQ2UOTc1y9cp9_LOOD4EFeAV+dG5_LkFjqmkgYNSbAmg@mail.gmail.com> (raw)

Hi Hackers,

Ensure that internal authentication when combined with other authentication
providers, the order of internal source should not matter while picking up
the provider.

-- 
*Rahul Shirsat*
Senior Software Engineer | EnterpriseDB Corporation.


Attachments:

  [application/octet-stream] RM6832.patch (765B, 3-RM6832.patch)
  download | inline diff:
diff --git a/web/pgAdmin4.py b/web/pgAdmin4.py
index dc1924cbd..851c107af 100644
--- a/web/pgAdmin4.py
+++ b/web/pgAdmin4.py
@@ -104,7 +104,13 @@ if config.SERVER_MODE:
 
 # Authentication sources
 if len(config.AUTHENTICATION_SOURCES) > 0:
-    app.PGADMIN_EXTERNAL_AUTH_SOURCE = config.AUTHENTICATION_SOURCES[0]
+    # Creating a temporary auth source list removing INTERNAL
+    # This change is done to avoid selecting INTERNAL authentication when user
+    # mistakenly keeps that the first option.
+    auth_source = [x for x in config.AUTHENTICATION_SOURCES
+                   if x != INTERNAL]
+    app.PGADMIN_EXTERNAL_AUTH_SOURCE = auth_source[0] \
+        if len(auth_source) > 0 else INTERNAL
 else:
     app.PGADMIN_EXTERNAL_AUTH_SOURCE = INTERNAL
 


view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [patch][pgAdmin4] RM6832 oauth2 + internal authentication failure when order is changed in config file
  In-Reply-To: <CAKtn9dNQ2UOTc1y9cp9_LOOD4EFeAV+dG5_LkFjqmkgYNSbAmg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox