Skip to content

Commit

Permalink
trusted host code
Browse files Browse the repository at this point in the history
  • Loading branch information
driskull committed Nov 3, 2015
1 parent 967614d commit de9e3ea
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions js/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,14 +507,17 @@ define([
callbackParamName: "callback"
}).then(lang.hitch(this, function (response) {
if (this.templateConfig.webTierSecurity) {
// Iterate over the list of authorizedCrossOriginDomains
// and add each as a javascript obj to the corsEnabledServers
if (response.authorizedCrossOriginDomains && response.authorizedCrossOriginDomains.length) {
var trustedHost;
if (response.authorizedCrossOriginDomains && response.authorizedCrossOriginDomains.length > 0) {
for (var i = 0; i < response.authorizedCrossOriginDomains.length; i++) {
esriConfig.defaults.io.corsEnabledServers.push({
host: response.authorizedCrossOriginDomains[i],
withCredentials: true
});
trustedHost = response.authorizedCrossOriginDomains[i];
// add if trusted host is not null, undefined, or empty string
if (esriLang.isDefined(trustedHost) && trustedHost.length > 0) {
esriConfig.defaults.io.corsEnabledServers.push({
host: trustedHost,
withCredentials: true
});
}
}
}
}
Expand Down

0 comments on commit de9e3ea

Please sign in to comment.