[QGIS-Developer] Use of QgsAuthManager

Alessandro Pasotti apasotti at gmail.com
Mon Mar 5 05:18:06 PST 2018


Hi Richard,

it's up to you, you can also create an authentication configuration
programmatically from python, i.e. create a simple username/password
dialog, check if the credentials are valid and then create an
authentication configuration and store it in the authentication DB.

Also, store the authcfg id (not the credentials!) into your plugin settings
and use that one for all subsequent calls.

There should be an example (for 2.x but the auth stuff has'n changed):
https://github.com/boundlessgeo/lib-qgis-commons/blob/master/qgiscommons2/network/oauth2.py#L89

In QGIS 3 all the auth GUI dialogs are wrapped in ptyhon so that you can
use them directly.




On Mon, Mar 5, 2018 at 2:09 PM, Richard Duivenvoorde <rdmailings at duif.net>
wrote:

> On 05-03-18 13:10, Alessandro Pasotti wrote:
> >
> > from python you can call:
> >
> > QgsApplication.instance().authManager()
>
> Ah, thanks Ale, got that working; ... if I have a Authentication
> Configuration in my config with given key.
>
> Is there (still) a way to force users to give username/password, and
> just use it for given session
>
> Or should the user always go through QgsAuthConfigSelect().show() to
> - first set a master keyword if not set yet on db
> - create a Authentication config by pressing the plus-sign?
>
> Isn't this dialog (see attached screenie) not to intimidating for
> average user?
>
> Thanks for given input.
>
> Regards,
>
> Richard
>
>
>
>
>
>


-- 
Alessandro Pasotti
w3:   www.itopen.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180305/73a8610f/attachment.html>


More information about the QGIS-Developer mailing list