FieldStudiesCouncil / QGIS-Biological-Recording-Tools

QGIS plugin for biological recorders. Created with the FSC Tomorrow's Biodiversity project.
GNU General Public License v3.0
10 stars 4 forks source link

Adding basic authentication of wms #2

Closed chrisjohnson1988 closed 9 years ago

chrisjohnson1988 commented 9 years ago

Hey Richard,

One of the other developers for the NBN Gateway mentioned about your QGIS plugin. I've had a look and am very impressed.

I am also aware that you have an issue regarding the authentication. One potential way for this to work could be to use Basic Authentication. This pull request documents how that could work in your QGIS plugin.

Currently the NBN Gateway GIS system doesn't support Basic Authentication, however I have put forward a pull request for the NBN Gateway code base so that it does.

@mattdebont will be reviewing this pull request and if he accepts, then your QGIS plugin should be able to authenticate.

@mattdebont would you be able to let @burkmarr know if/when this feature goes live?

Cheers,

Chris

burkmarr commented 9 years ago

Hi Chris - thanks very much for your interest. I'm not sure why the current NBN model for WMS authentication does not currently work from QGIS - it works elsewhere. To be honest I put my investigation into the problem on hold and decided to publish the tools without it the option to login - just in the interests of time. I had intended to pursue the problem again when I have more time. But if basic authentication gets added and solves the problem, that will be great!

I'm new to open source development so your pull request has also been an education to me and I'm starting to become aware of the power of this environment. If Matt does enable basic authentication, I'll merge your pull request.

chrisjohnson1988 commented 9 years ago

Great stuff Richard. I have also answered you gis exchange question This should explain how to use the normal authentication method and also be able to filter using the other wms filters (time/datasets)

Even if you were to accept this pull request, I would advice that the username, password and url parameters which are supplied to the QgsRasterLayer are also encoded in a similar fashion.

Best of luck.

Chris

mattdebont commented 9 years ago

Hi, I have merged in the change on our side and it should now be on the live site, to try out, please let us know if you have further problems but it looks like it should work now.

Matt

burkmarr commented 9 years ago

Thanks both very much indeed. I read Chris' suggestion on the GIS exchange forum and made some changes suggested there which got it working with the hashed password. I also confirmed that using the QGIS standard interface access to WMS that specifying user credential there works too (it didn't before) which I guess indicates that Matt's basic authentication change has also been successful. So now overwhelmed with options! I haven't accepted the pull request since I've kept the hashed password method for now. There's a whole bunch of code in that NBN tool that needs revisiting, removing, tidying up etc. It's a bit of a mess currently. I will do that soon. For now I've published 1.4.3 to the QGIS repository which enables logged in access to the NBN WMS. I've credited you both in the tool metadata. Thanks again.

chrisjohnson1988 commented 9 years ago

That sounds great! I will close this pull request down as it sounds like you have a plan now. Please feel free to accept the answer on stack exchange.