[OpenLayers-Users] Basic authZ issue

Yves Moisan yves.moisan at boreal-is.com
Wed Jul 9 15:23:55 EDT 2008


Hi All,

We are accessing a secure (Basic Auth) Apache directory through OL and
users find it bothersome to fill in a pop up user:pass window.  In a bid
to bypass the popup, we're looking for a way to shove in the right
header in the OpenLayers.Layer.WMS call.

We succeeded using the XmlHTTPRequest object on its own.  We also
succeeded by modifying the proxy.cgi script people use for cross-domain
access (by adding lines like those in the script before opening the
request object) :

base64string = base64.encodestring('%s:%s' % (username, password))[:-1]
r.add_header("Authorization", "Basic %s" % base64string) 

Servers that used to return 401 (or 500 in IE) errors work well, so we
know we are passing the right user:pass data.  However, this does not
work from OL.  We don't know where to add headers to the request at the
OL level.  This
http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Request.js?rev=7335 seems to cater for headers.  Are there ways of doing that with the current version of OL ?

TIA,

Yves Moisan




More information about the Users mailing list