Bug report #21582

Postgres connection - login credentials / authentication

Added by Erhard Ungerböck over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Data Provider/PostGIS
Affected QGIS version:3.6.0 Regression?:Yes
Operating System:Windows 10 Pro 64-Bit Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:29398

Description

Since changing to qgis 3 qgis asks for the postgres login credentials multiple times when opening a project (see http://osgeo-org.1560.x6.nabble.com/QGIS-3-Postgres-Authentication-Issue-td5391047.html)

This occurs for old projects as well as for new ones, i tried with a clean profile and no extensions. tried in QGIS 3.6. but problem occured also in 3.2 and 3.4

qgis also asks for login credentials when working - but nothing happens, when i close the prompt window without entering anything

saving the pw with the project or authentication works but affects only layers added afterwards - is this supposed to work like that?

it seems the layer properties, that are stored in the project file, affect this. if I understand this correctly,they are set when the layer is added, but not changed afterwards, so no authentication or stored pw for "old" layers.

I want to prepare a project template for different user, who then can enter and store their login credentials, how can this be done?

lUgzq.png - repeatedly asking credentials (3.68 KB) Gediminas B, 2019-03-15 04:43 PM

Associated revisions

Revision 2af35352
Added by Jürgen Fischer over 5 years ago

[needsbackport] apply an alternative fix for #20826

Partly reverts c9e761649, which removed the synchronizatiion of
credential requests (eg. in a project that has multiple layers from the
same postgresql database without credentials) and led to multiple
concurrent requests for the same credentials.

Some of which were silently discarded, when events processed in the
dialogs exec() event loop tried to reinvoke the dialog and caused
invalid layers.

Authentications caused by network requests can still cause this.

The credential cache is now guarded by a separate mutex.

Revision e26c4bf3
Added by Jürgen Fischer over 5 years ago

[needsbackport] apply an alternative fix for #20826 & #21582

Partly reverts c9e761649, which removed the synchronizatiion of
credential requests (eg. in a project that has multiple layers from the
same postgresql database without credentials) and led to multiple
concurrent requests for the same credentials.

Some of which were silently discarded, when events processed in the
dialogs exec() event loop tried to reinvoke the dialog and caused
invalid layers.

Authentications caused by network requests can still cause this.

The credential cache is now guarded by a separate mutex.

(cherry picked from commit 2af35352167257f5f3f73bea8fbee6f5506829bb)

Revision f7d47f08
Added by Jürgen Fischer over 5 years ago

[needsbackport] apply an alternative fix for #20826 & #21582

Partly reverts c9e761649, which removed the synchronizatiion of
credential requests (eg. in a project that has multiple layers from the
same postgresql database without credentials) and led to multiple
concurrent requests for the same credentials.

Some of which were silently discarded, when events processed in the
dialogs exec() event loop tried to reinvoke the dialog and caused
invalid layers.

Authentications caused by network requests can still cause this.

The credential cache is now guarded by a separate mutex.

(cherry picked from commit 2af35352167257f5f3f73bea8fbee6f5506829bb)

History

#1 Updated by Eron Lloyd over 5 years ago

I can confirm that I'm also having this issue, both for 3.6.0 and 3.4.5 LTS for macOS. I made no other changes to the data sources or project file.

#2 Updated by Giedrius Vaivilavičius over 5 years ago

I can confirm that I'm also having this issue, both for 3.6.0 and 3.4.5 LTS for Windows 10, Debian 9. It starts with version 3.4.5. With 3.4.4 everything works fine. We are downgrading to 3.4.4. But I hope it's temporary?

#4 Updated by Giedrius Vaivilavičius over 5 years ago

working in localhost same problem

#5 Updated by Gediminas B over 5 years ago

Action: At first time when opening project (project has multiple layers from same DB) on qgis 3.4.5 and 3.6 versions (in Windows 10) needs credentials to connect to PostgreSQL DB.

Problem: But after that when connection is success with correct credentials the qgis repeatedly asks the same credentials again to connect to the same DB when the maps is zooming and moving and etc.

With qgis 2.18, 3.4.0, 3.4.1 versions all works fine and don't asking repeatedly credentials after first correct time.
Maybe someone knows whats is wrong?

#6 Updated by Giovanni Manghi over 5 years ago

  • Regression? changed from No to Yes
  • Priority changed from Normal to High

#7 Updated by Jürgen Fischer over 5 years ago

  • Status changed from Open to Closed
  • Resolution set to fixed/implemented

#8 Updated by Giedrius Vaivilavičius over 5 years ago

problem persist on latest version of QGIS (3.4.6 and 3.6.1)

#9 Updated by Jürgen Fischer over 5 years ago

Giedrius Vaivilavičius wrote:

problem persist on latest version of QGIS (3.4.6 and 3.6.1)

The fix is not backported yet - have you verified with master?

#10 Updated by Giedrius Vaivilavičius over 5 years ago

with 3.5.0-Master the problem does not occur

#11 Updated by Jürgen Fischer over 5 years ago

Giedrius Vaivilavičius wrote:

with 3.5.0-Master the problem does not occur

master is currently 3.7.0

#12 Updated by Giedrius Vaivilavičius over 5 years ago

So but for me the repository (https://qgis.org/debian-nightly) gives only 3.5.0.

#13 Updated by Jürgen Fischer over 5 years ago

Giedrius Vaivilavičius wrote:

So but for me the repository (https://qgis.org/debian-nightly) gives only 3.5.0.

Which distribution are you using?

#14 Updated by Giedrius Vaivilavičius over 5 years ago

Jürgen Fischer wrote:

Which distribution are you using?

Debian 9 (stretch)

#15 Updated by Jürgen Fischer over 5 years ago

Giedrius Vaivilavičius wrote:

Jürgen Fischer wrote:

Which distribution are you using?

Debian 9 (stretch)

Support for stretch was discontinued as we need Qt 5.9 for QGIS 3.6.

#16 Updated by Giedrius Vaivilavičius over 5 years ago

I upgraded to Debian buster. There is no problem with QGIS 3.7.0. Are you planning the fix backported to 3.4 ltr?

#17 Updated by Jürgen Fischer over 5 years ago

Giedrius Vaivilavičius wrote:

I upgraded to Debian buster. There is no problem with QGIS 3.7.0. Are you planning the fix backported to 3.4 ltr?

Already done - see attached commits.

Also available in: Atom PDF