Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Commit

Permalink
fixed #246: added authentication support to WMSGetFeatureInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarto committed Oct 30, 2013
1 parent 002e7dd commit fb01c8a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ gxp.plugins.WMSGetFeatureInfo = Ext.extend(gxp.plugins.Tool, {
queryVisible: true,
layers: [x.getLayer()],
vendorParams: vendorParams,
authentication: this.authentication,
eventListeners: {
beforegetfeatureinfo: function(evt) {
//first getFeatureInfo in chain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,15 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
}, params);
}
OpenLayers.Util.applyDefaults(params, this.vendorParams);
var headers;
if(this.authentication) {
headers = {
"Authorization": "Basic " + Base64.encode(this.authentication.user + ":" + this.authentication.password)
};
}
return {
url: url,
headers: headers,
params: OpenLayers.Util.upperCaseObject(params),
callback: function(request) {
this.handleResponse(clickPosition, request, url);
Expand Down Expand Up @@ -460,9 +467,10 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
var layers;
for (var url in services) {
layers = services[url];
var wmsOptions = this.buildWMSOptions(url, layers,
clickPosition, layers[0].params.FORMAT);
OpenLayers.Request.GET(wmsOptions);
var wmsOptions = this.buildWMSOptions(url, layers,
clickPosition, layers[0].params.FORMAT);
OpenLayers.Request.GET(wmsOptions);

}
}
},
Expand Down

0 comments on commit fb01c8a

Please sign in to comment.