[Qgis-developer] PyQGIS: do WMS and WFS providers use QgsNetworkAccessManager.instance()?
enzogis
enzo.ciarmoli at csi.it
Fri May 27 04:24:09 PDT 2016
Hi all,
The main goal is to access to WMS/WFS exposed behind Shibboleth
authentication page.
I made many tests and partially I have success with a workaround: not sure
but if I'm not wrong then I could signal a strange behaviour of wms provider
with QgsNetworkAccessManager.instance()
The problem is complex, I try to shortly explain:
I need to load WMS/WFS layers that are exposed behind Shibboleth (SAML2)
authentication page.
>From a web browser, the authentication system consists of these steps:
- call the url
http://example/wms?service=WMS&version=1.1.0&request=GetCapabilities
- the system redirect to main authentication page https://secure/login.jsp
with many options
- the user indicates a valid PKCS#12 certificate
- only after success it redirect to the first url and the user could see the
wms response.
In QGIS 2.14.3 I imported certificate but when I try to load that WMS layer,
it shows an error: it expected wms capabilties response but it receive an
html from main authentication page.
Workaround:
Thus, to achieve the goal, I replicated in Python the authentication process
with a custom QWebView and extended QNetworkAccessManager with SSL support
to use certificate.
After succesfully access, the script dump cookies from the CookieJar and
transfers them to QgsNetworkAccessManager.instance().
In that situation, the instance is authenticated and i can manually load
layers and Shibboleth trusts cookies.
That workaround works fine for WFS , but it fails for WMS.
When i try to connect to WMS manually it have success and it shows a list of
capabilities , but when i select a layer and i try to load it shows an
error: in error logs there are html tags from the main authentication page.
It seems that WMS provider uses QgsNetworkAccessManager.instance() only for
get capabilities but not for loading each layer.
Instead, the same solution works fine for WFS: from the dialog that show
capabilities I can load a layer in QGIS and I assume that it uses
authenticated QgsNetworkAccessManager.instance().
That different behaviour of wms and wfs providers is correct?
It is a bug or I misunderstand something?
Any suggestion would be greatly appreciated.
If necessary for details I will attach code snippet.
TIA
--
Enzo Ciarmoli
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/PyQGIS-do-WMS-and-WFS-providers-use-QgsNetworkAccessManager-instance-tp5268513.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
More information about the Qgis-developer
mailing list