[GIS] How to access an wms layer that requires authorization via OpenLayers

javajavascriptopenlayers-2wms

Is there a way to send username and password parameter to a wms layer that needs authorization?

If not, I guess it's perhaps a non-spatial thing to solve so that you before the javascript sends a wms request you initiate a httprequest to the server where the wms service is hosted. If anyone have an good example of how to do that from java, html or javascript I would really appreciate it.

If you use firefox you could add http:\username:password@wmsurl and its solved and the information is the stored in the session/cache …

Thanks for the help
Mike

Best Answer

It's not the work of WMS server that do the authorization, but the HTTP server. Usually we save logged in user's information in the sessions and provide those information when requesting to a WMS server in the cookies.