public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][Patch] - RM #5776 -  Needlessly prompted for a password with SSPI logins
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin4][Patch] - RM #5776 -  Needlessly prompted for a password with SSPI logins
@ 2021-05-05 05:58 Khushboo Vashi <[email protected]>
  2021-05-05 06:11 ` Re: [pgAdmin4][Patch] - RM #5776 - Needlessly prompted for a password with SSPI logins Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Khushboo Vashi @ 2021-05-05 05:58 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,

Please find the attached patch for RM #5776 -  Needlessly prompted for a
password with SSPI logins.

To fix this issue,  I have enabled the "Kerberos authentication" flag in
the server dialog for Desktop mode also. So, if this flag is set to True,
pgAdmin will not prompt for a password on connection/reconnection.

This patch also includes the Jasmine test failures caused by my previous
Kerberos patch.

Thanks,
Khushboo


Attachments:

  [application/octet-stream] RM_5776.patch (5.5K, 3-RM_5776.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/static/js/server.js b/web/pgadmin/browser/server_groups/servers/static/js/server.js
index fd525d763..b21cba431 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/server.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/server.js
@@ -14,12 +14,11 @@ define('pgadmin.node.server', [
   'pgadmin.alertifyjs', 'pgadmin.backform',
   'sources/browser/server_groups/servers/model_validation',
   'pgadmin.authenticate.kerberos',
-  'pgadmin.browser.constants',
   'pgadmin.browser.server.privilege',
 ], function(
   gettext, url_for, $, _, Backbone, pgAdmin, pgBrowser,
   supported_servers, current_user, Alertify, Backform,
-  modelValidation, Kerberos, pgConst,
+  modelValidation, Kerberos,
 ) {
 
   if (!pgBrowser.Nodes['server']) {
@@ -910,11 +909,7 @@ define('pgadmin.node.server', [
           id: 'kerberos_conn', label: gettext('Kerberos authentication?'), type: 'switch',
           group: gettext('Connection'), 'options': {
             'onText':  gettext('True'), 'offText':  gettext('False'), 'size': 'mini',
-          }, disabled: function() {
-            if (current_user['current_auth_source'] != pgConst['KERBEROS'])
-              return true;
-            return false;
-          },
+          }
         },{
           id: 'password', label: gettext('Password'), type: 'password', maxlength: null,
           group: gettext('Connection'), control: 'input', mode: ['create'],
diff --git a/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js b/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
index 7e0ddd63f..1a59d420a 100644
--- a/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
+++ b/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js
@@ -169,7 +169,7 @@ export class BackupDialogWrapper extends DialogWrapper {
       this.setExtraParameters(selectedTreeNode, treeInfo);
       let backupDate = this.view.model.toJSON();
 
-      if(userInfo['auth_sources'] == 'KERBEROS' && (backupDate.type == 'globals' || backupDate.type == 'server')) {
+      if(userInfo['current_auth_source'] == 'KERBEROS' && (backupDate.type == 'globals' || backupDate.type == 'server')) {
         let newPromise = fetch_ticket_lifetime();
         newPromise.then(
           function(lifetime) {
diff --git a/web/regression/javascript/backup/backup_dialog_wrapper_spec.js b/web/regression/javascript/backup/backup_dialog_wrapper_spec.js
index 24edadb82..1fcb44c04 100644
--- a/web/regression/javascript/backup/backup_dialog_wrapper_spec.js
+++ b/web/regression/javascript/backup/backup_dialog_wrapper_spec.js
@@ -46,6 +46,7 @@ describe('BackupDialogWrapper', () => {
       },
       keyboardNavigation: jasmine.createSpyObj('keyboardNavigation', ['getDialogTabNavigator']),
     };
+
     noDataNode = pgBrowser.treeMenu.addNewNode('level1.1', undefined, [{id: 'level1'}]);
     serverTreeNode = pgBrowser.treeMenu.addNewNode('level2.1', {
       _type: 'server',
diff --git a/web/regression/javascript/backup/global_server_backup_dialog_spec.js b/web/regression/javascript/backup/global_server_backup_dialog_spec.js
index d15a89556..77c635dff 100644
--- a/web/regression/javascript/backup/global_server_backup_dialog_spec.js
+++ b/web/regression/javascript/backup/global_server_backup_dialog_spec.js
@@ -20,7 +20,6 @@ describe('GlobalServerBackupDialog', () => {
   let alertifySpy;
   let backupModelSpy;
 
-
   let rootNode;
   let serverTreeNode;
   let ppasServerTreeNode;
@@ -74,7 +73,6 @@ describe('GlobalServerBackupDialog', () => {
         alertifySpy,
         backupModelSpy
       );
-
       pgBrowser.get_preference = jasmine.createSpy('get_preferences');
     });
 
diff --git a/web/regression/javascript/fake_constants.js b/web/regression/javascript/fake_constants.js
new file mode 100644
index 000000000..4bc7a1651
--- /dev/null
+++ b/web/regression/javascript/fake_constants.js
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin 4 - PostgreSQL Tools
+//
+// Copyright (C) 2013 - 2021, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+//////////////////////////////////////////////////////////////////////////
+
+define(function () {
+  return {
+    'INTERNAL': 'internal',
+    'LDAP': 'ldap',
+    'KERBEROS': 'kerberos'
+  };
+});
+
diff --git a/web/regression/javascript/fake_current_user.js b/web/regression/javascript/fake_current_user.js
new file mode 100644
index 000000000..6ad0b45b8
--- /dev/null
+++ b/web/regression/javascript/fake_current_user.js
@@ -0,0 +1,15 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin 4 - PostgreSQL Tools
+//
+// Copyright (C) 2013 - 2021, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+//////////////////////////////////////////////////////////////////////////
+
+define(function () {
+  return {
+    'current_auth_source': 'internal'
+  };
+});
+
diff --git a/web/webpack.test.config.js b/web/webpack.test.config.js
index e72798e9a..e0b6fd69f 100644
--- a/web/webpack.test.config.js
+++ b/web/webpack.test.config.js
@@ -179,6 +179,8 @@ module.exports = {
       'pgadmin.tools.erd': path.join(__dirname, './pgadmin/tools/erd/static/js'),
       'bundled_codemirror': path.join(__dirname, './pgadmin/static/bundle/codemirror'),
       'tools': path.join(__dirname, './pgadmin/tools/'),
+      'pgadmin.user_management.current_user': regressionDir + '/javascript/fake_current_user',
+      'pgadmin.browser.constants': regressionDir + '/javascript/fake_constants',
     },
   },
 };


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [pgAdmin4][Patch] - RM #5776 - Needlessly prompted for a password with SSPI logins
  2021-05-05 05:58 [pgAdmin4][Patch] - RM #5776 -  Needlessly prompted for a password with SSPI logins Khushboo Vashi <[email protected]>
@ 2021-05-05 06:11 ` Akshay Joshi <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Akshay Joshi @ 2021-05-05 06:11 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers

Thanks, patch applied.

On Wed, May 5, 2021 at 11:28 AM Khushboo Vashi <
[email protected]> wrote:

> Hi,
>
> Please find the attached patch for RM #5776 -  Needlessly prompted for a
> password with SSPI logins.
>
> To fix this issue,  I have enabled the "Kerberos authentication" flag in
> the server dialog for Desktop mode also. So, if this flag is set to True,
> pgAdmin will not prompt for a password on connection/reconnection.
>
> This patch also includes the Jasmine test failures caused by my previous
> Kerberos patch.
>
> Thanks,
> Khushboo
>


-- 
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres <http://edbpostgres.com>*

*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-05-05 06:11 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05 05:58 [pgAdmin4][Patch] - RM #5776 -  Needlessly prompted for a password with SSPI logins Khushboo Vashi <[email protected]>
2021-05-05 06:11 ` Re: [pgAdmin4][Patch] - RM #5776 - Needlessly prompted for a password with SSPI logins Akshay Joshi <[email protected]>

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