<div dir="ltr">Hi Stefan,<div><br></div><div>Sorry for the delay in reply. OAuth should be able to be implemented as an authentication method plugin for the new system, thereby making it available for WxS connections, as well as other HTTP connections.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I have a proposed talk and workshop on auth method plugins for the QGIS conference in Girona (no word yet on whether they are accepted).</div><div class="gmail_extra"><br></div><div class="gmail_extra">In the meantime, you could review existing auth method plugins and formulate some psuedo-code on the steps needed to intercept the request and work with OAuth:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><a href="https://github.com/qgis/QGIS/tree/master/src/auth">https://github.com/qgis/QGIS/tree/master/src/auth</a></div><div class="gmail_extra"><br></div><div class="gmail_extra">This is the base plugin class:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><a href="https://github.com/qgis/QGIS/blob/master/src/core/auth/qgsauthmethod.h">https://github.com/qgis/QGIS/blob/master/src/core/auth/qgsauthmethod.h</a><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">The last thing I did was add auth method plugin support to the system, which allows a C++ plugin to be built, then dropped into an existing 2.14 install, etc.<br clear="all"><div><div class="gmail_signature"><br></div><div class="gmail_signature">Regards,</div><div class="gmail_signature"><br>Larry Shaffer<br>Dakota Cartography<br>Black Hills, South Dakota</div></div>
<br><div class="gmail_quote">On Sat, Feb 27, 2016 at 1:32 PM, Stefan Keller <span dir="ltr"><<a href="mailto:sfkeller@gmail.com" target="_blank">sfkeller@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,<br>
<br>
In a Python plugin [1] we implemented HTTP "Basic Authentication" and<br>
"NTLM authentication".<br>
<br>
Now I'm still looking for a solution using OAuth 2.0 for build-in WxS<br>
(WMS/WMTS, WFS) as well as for Python plugins.<br>
This seems to be also of some interest for other QGIS users [2].<br>
<br>
<br>
The only code related to OAuth2 I found is in the CartoDB plugin [3].<br>
But this does not help WxS nor my Python plugin.<br>
<br>
Also Paolo's pointer to LizMap relates not to QGIS Python plugin but<br>
to restricted access to lizmap online AFAIK.<br>
<br>
I heard about the authentication configuration system with master password [4].<br>
But we still need more information when the API is available.<br>
<span class=""><br>
2016-01-12 23:36 GMT+01:00 Larry Shaffer <<a href="mailto:larrys@dakotacarto.com">larrys@dakotacarto.com</a>>:<br>
</span><span class="">> Until then, the continued Python access to the auth system credentials means<br>
> security is not good for the user. It should be considered for deprecation<br>
> or just complete removal in 2.14 release.<br>
<br>
</span>Any news on this, and on OAuth implementations for WxS and Python plugins?<br>
<br>
:Stefan<br>
<br>
[1] <a href="http://plugins.qgis.org/plugins/connector/" rel="noreferrer" target="_blank">http://plugins.qgis.org/plugins/connector/</a><br>
[2] <a href="https://groups.google.com/forum/#!topic/australian-qgis-user-group/agn7ehIPd3M" rel="noreferrer" target="_blank">https://groups.google.com/forum/#!topic/australian-qgis-user-group/agn7ehIPd3M</a><br>
[3] <a href="http://plugins.qgis.org/plugins/QgisCartoDB/" rel="noreferrer" target="_blank">http://plugins.qgis.org/plugins/QgisCartoDB/</a><br>
[4] <a href="https://github.com/qgis/QGIS/pull/1838" rel="noreferrer" target="_blank">https://github.com/qgis/QGIS/pull/1838</a><br>
<span class="im"><br>
<br>
2016-01-12 23:36 GMT+01:00 Larry Shaffer <<a href="mailto:larrys@dakotacarto.com">larrys@dakotacarto.com</a>>:<br>
</span><div class=""><div class="h5">> Hi Bernhard,<br>
><br>
> Please note that the Python support for direct access to the credentials via<br>
> the auth method config *may* be completely removed for security reasons.<br>
><br>
> Ideally, the expansion of credentials within a given auth method config<br>
> would only be done within the core application and connection methods (HTTP,<br>
> etc.) would be offered through a Python API. In this way an authcfg token<br>
> can be passed in and the connection established without access to<br>
> credentials.<br>
><br>
> However, such support and an API are not currently available. It is simple<br>
> enough to add to QgsNetworkAccessManager for HTTP[S] connections, but not so<br>
> simple for other types of connections, e.g. database via a library or<br>
> client. Once completed this means a plugin would not be able to access the<br>
> credentials and pass them on to a different connection method, e.g. Python<br>
> HTTP lib, etc.<br>
><br>
> Once such an API is available (or even now, with some work), plugins could<br>
> be 'authorized' by the user for access to credentials using revocable access<br>
> tokens or signed/revokable certificates.<br>
><br>
> Until then, the continued Python access to the auth system credentials means<br>
> security is not good for the user. It should be considered for deprecation<br>
> or just complete removal in 2.14 release.<br>
><br>
> Regards,<br>
><br>
> Larry Shaffer<br>
> Dakota Cartography<br>
> Black Hills, South Dakota<br>
><br>
> QGIS Support/Development | Boundless<br>
> <a href="mailto:lshaffer@boundlessgeo.com">lshaffer@boundlessgeo.com</a><br>
><br>
> On Tue, Jan 12, 2016 at 8:14 AM, Bernhard Ströbl <<a href="mailto:bernhard.stroebl@jena.de">bernhard.stroebl@jena.de</a>><br>
> wrote:<br>
>><br>
>> Hi Luigi,<br>
>><br>
>> many thanks! That was the key.<br>
>><br>
>> I now have<br>
>> <code><br>
>> am = QgsAuthManager.instance()<br>
>> myAuthMethodConfig = QgsAuthMethodConfig()<br>
>> am.loadAuthenticationConfig(mykey,myAuthMethodConfig,True)<br>
>> myAuthMethodConfig.configMap()<br>
>> </code><br>
>><br>
>> Bernhard<br>
>><br>
>><br>
>> Am 12.01.2016 um 15:58 schrieb Luigi Pirelli:<br>
>>><br>
>>> Hi Bernhard<br>
>>><br>
>>> be inspired by Boundless qgis-geoserver-plugin<br>
>>><br>
>>><br>
>>> <a href="https://github.com/boundlessgeo/qgis-geoserver-plugin/blob/master/src/geoserverexplorer/gui/gsexploreritems.py#L502" rel="noreferrer" target="_blank">https://github.com/boundlessgeo/qgis-geoserver-plugin/blob/master/src/geoserverexplorer/gui/gsexploreritems.py#L502</a><br>
>>><br>
>>> I hope it's enough<br>
>>><br>
>>> cheers<br>
>>> Luigi Pirelli<br>
>>><br>
>>><br>
>>> **************************************************************************************************<br>
>>> * Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com<br>
>>> * LinkedIn: <a href="https://www.linkedin.com/in/luigipirelli" rel="noreferrer" target="_blank">https://www.linkedin.com/in/luigipirelli</a><br>
>>> * Stackexchange: <a href="http://gis.stackexchange.com/users/19667/luigi-pirelli" rel="noreferrer" target="_blank">http://gis.stackexchange.com/users/19667/luigi-pirelli</a><br>
>>> * GitHub: <a href="https://github.com/luipir" rel="noreferrer" target="_blank">https://github.com/luipir</a><br>
>>> * Mastering QGIS:<br>
>>> <a href="https://www.packtpub.com/application-development/mastering-qgis" rel="noreferrer" target="_blank">https://www.packtpub.com/application-development/mastering-qgis</a><br>
>>><br>
>>> **************************************************************************************************<br>
>>><br>
>>><br>
>>> On 12 January 2016 at 12:47, Bernhard Ströbl <<a href="mailto:bernhard.stroebl@jena.de">bernhard.stroebl@jena.de</a>><br>
>>> wrote:<br>
>>>><br>
>>>> Hi all,<br>
>>>><br>
>>>> my goal is that my users do not save their PostgreSQL passwords in clear<br>
>>>> text but that they use the new Authentification system to do so. For my<br>
>>>> plugins I would need access to the PostgreSQL username and password,<br>
>>>> though.<br>
>>>> Is this generally possible in spite of security considerations as<br>
>>>> mentioned<br>
>>>> in the QGEP? If yes, how would I do it?<br>
>>>><br>
>>>> what I have so far is:<br>
>>>> <code><br>
>>>> am = QgsAuthManager.instance()<br>
>>>> myAuthMethodConfig = am.availableAuthMethodConfigs()[mykey]<br>
>>>> myAuthMethodConfig.configMap() # returns an empty dict :-(<br>
>>>> </code><br>
>>>><br>
>>>> QGIS 2.12.2<br>
>>>><br>
>>>> any help appreciated<br>
>>>><br>
>>>> regards<br>
>>>><br>
>>>> Bernhard<br>
>>>><br>
>>>> [1]<br>
>>>><br>
>>>> <a href="https://github.com/dakcarto/QGIS-Enhancement-Proposals/blob/auth-system/qep-14-authentication-system.rst" rel="noreferrer" target="_blank">https://github.com/dakcarto/QGIS-Enhancement-Proposals/blob/auth-system/qep-14-authentication-system.rst</a><br>
>>>><br>
>>>><br>
>>>> __________ Information from ESET Mail Security, version of virus<br>
>>>> signature<br>
>>>> database 12855 (20160112) __________<br>
>>>><br>
>>>> The message was checked by ESET Mail Security.<br>
>>>> <a href="http://www.eset.com" rel="noreferrer" target="_blank">http://www.eset.com</a><br>
>>>><br>
>>>><br>
>>>> _______________________________________________<br>
>>>> Qgis-developer mailing list<br>
>>>> <a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
>>>> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
>>>> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
>>><br>
>>><br>
>>><br>
>>> __________ Information from ESET Mail Security, version of virus<br>
>>> signature database 12856 (20160112) __________<br>
>>><br>
>>> The message was checked by ESET Mail Security.<br>
>>> <a href="http://www.eset.com" rel="noreferrer" target="_blank">http://www.eset.com</a><br>
>>><br>
>>><br>
>><br>
>> --<br>
>> Bernhard Ströbl<br>
>> Anwendungsbetreuer GIS<br>
>><br>
>> Kommunale Immobilien Jena<br>
>> Am Anger 26<br>
>> 07743 Jena<br>
>><br>
>> Tel.: 03641 49- 5190<br>
>> E-Mail: <a href="mailto:bernhard.stroebl@jena.de">bernhard.stroebl@jena.de</a><br>
>> Internet: <a href="http://www.kij.de" rel="noreferrer" target="_blank">www.kij.de</a><br>
>><br>
>><br>
>> Kommunale Immobilien Jena<br>
>> Eigenbetrieb der Stadt Jena<br>
>> Werkleiter: Karl-Hermann Kliewe<br>
>><br>
>><br>
>> __________ Information from ESET Mail Security, version of virus signature<br>
>> database 12856 (20160112) __________<br>
>><br>
>><br>
>> The message was checked by ESET Mail Security.<br>
>> <a href="http://www.eset.com" rel="noreferrer" target="_blank">http://www.eset.com</a><br>
>><br>
>><br>
>> _______________________________________________<br>
>> Qgis-developer mailing list<br>
>> <a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
>> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
>> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Qgis-developer mailing list<br>
> <a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</div></div></blockquote></div><br></div></div>