Hi Christian,
Thanks so much for you response. I looked at your example and understood basic authentication, but I don’t know to how to use it with openLayers. Can you please give me an example or guidelines?
I use openLayers to do WMS request as below. How to use basic authentication for this?
…
// setup tiled layer
tiled = new OpenLayers.Layer.WMS(
“Geoserver layers - Tiled”, “http://localhost:8080/geoserver/nc/wms”,
{
LAYERS: ‘NC_Map’,
STYLES: ‘’,
format: format,
tiled: true,
tilesOrigin : map.maxExtent.left + ‘,’ + map.maxExtent.bottom
},
{
buffer: 0,
displayOutsideMaxExtent: true,
isBaseLayer: true,
yx : {‘EPSG:4326’ : true}
}
);
// setup single tiled layer
untiled = new OpenLayers.Layer.WMS(
“Geoserver layers - Untiled”, “http://localhost:8080/geoserver/nc/wms”,
{
LAYERS: ‘NC_Map’,
STYLES: ‘’,
format: format
},
{
singleTile: true,
ratio: 1,
isBaseLayer: true,
yx : {‘EPSG:4326’ : true}
}
);
map.addLayers([untiled, tiled]);
From: “christian.mueller@anonymised.com” <christian.mueller@anonymised.com.>
To: Meichun Li pcloudy2005@anonymised.com
Cc: “geoserver-users@lists.sourceforge.net” geoserver-users@anonymised.comrge.net
Sent: Wednesday, January 16, 2013 1:01 AM
Subject: Re: [Geoserver-users] How to access secured WMS in web application
To avoid the popup (challenge) you have to send the Http Header
Authorization
which each request.
Look here for an example
http://www.avajava.com/tutorials/lessons/how-do-i-connect-to-a-url-using-basic-authentication.html
Christian
Zitat von Meichun Li <pcloudy2005@anonymised.com>:
Hi,
My web application uses Struts Framework, and the enviroments are JDK 6,Tomcat 6, GeoServer 2.2.2.
I configured GeoServer to secure WMS, a basic authencitation window pops up for WMS request. For example, user name and password
are required to input to access
http://localhost:8080/geoserver/topp/wms?service=WMS&version=1.1.0&request=GetMap&layers=topp:states&styles=&bbox=-124.73142200000001,24.955967,-66.969849,49.371735&width=780&height=330&srs=EPSG:4326&format=application/openlayers
In my web application, I don’t want to pass username and password in the URL string, instead, I want to access the secured WMS without authentication window.
I used ol4jsf proxy but it doesn’t work, the autentication window still pops up.
Please see below for my set up. Is there something wrong?
In my JSP page, I do the WMS request such as these:
untiled = new OpenLayers.Layer.WMS(
“topp:states - Untiled”, “http://localhost:8080/geoserver/topp/wms”,
{
LAYERS: ‘topp:states’,
STYLES: ‘’,
format: format
},
{
singleTile: true,
ratio: 1,
isBaseLayer: true,
yx : {‘EPSG:4326’ : true}
}
);
I put ol4jsf-core-2.5.0.jar in my application WEB-INF/lib floder and create ol4jsf-proxy.xml in WEB-INF/classes:
<?xml version="1.0" encoding="UTF-8"?>
Development Environment.
[http://http:localhost:8080/geoserver/wms](http://http:localhost:8080/geoserver/wms)
admin
geoserver
In my web application web.xml page, I added these:
OL4JSFProxy
org.ol4jsf.proxy.servlet.OL4JSFProxy
0
OL4JSFProxy
/OL4JSFProxy/*
Any suggestions are highly appreciated.
Thanks!
Maggie
This message was sent using IMP, the Internet Messaging Program.