<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Sending token(s) to Non-ArcGIS WMS services in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sending-token-s-to-non-arcgis-wms-services/m-p/223972#M20837</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We are using the ArcGIS v3.2 Javascript API.&amp;nbsp; Most of our mapping is done by ArcGIS, but we have a swappable base layer that we allow the user to change (aerial and satellite imagery or topography).&amp;nbsp; We are doing this using an esri.layers.WMSLayer().&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The service that is supplying this imagery is proxied through a mapproxy (&lt;/SPAN&gt;&lt;A href="http://mapproxy.org/"&gt;http://mapproxy.org/&lt;/A&gt;&lt;SPAN&gt;) server.&amp;nbsp; Some of these proxied layers we have to pay for per-request and require a user token with each request.&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been looking at the IdentityManager and IdentityManagerBase classes but from what I've read they're only applicable if you are using a secured ArcGIS server.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone have any ideas on how this might be done?&amp;nbsp;&amp;nbsp; I've tried embedding the tokens in the url when creating the WMSLayer but those are stripped when the javascript API starts calling out to the service.&amp;nbsp; Well, to be clear, the token remains in the first call to our proxy page (esri.config.defaults.io.proxyUrl) but is then gone when the API makes a direct call to the mapproxy service.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The request to the proxy page looks like this (I've removed the actual IP):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://localhost:47689/Map/Proxy.ashx?http://1.1.1.1/mapproxy/service?token=zzzzz&amp;amp;SERVICE=WMS&amp;amp;REQUEST=GetCapabilities"&gt;http://localhost:47689/Map/Proxy.ashx?http://1.1.1.1/mapproxy/service?token=zzzzz&amp;amp;SERVICE=WMS&amp;amp;REQUEST=GetCapabilities&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then the API goes directly to the proxied page:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://1.1.1.1/mapproxy/service?SERVICE=WMS&amp;amp;REQUEST=GetMap&amp;amp;FORMAT=image/png&amp;amp;TRANSPARENT=TRUE&amp;amp;STYLES=&amp;amp;VERSION=1.1.1&amp;amp;LAYERS=topo&amp;amp;WIDTH=1584&amp;amp;HEIGHT=563&amp;amp;SRS=EPSG:900913&amp;amp;BBOX=-16818853.95026643,6075910,-9862030.049733568,8548569"&gt;http://1.1.1.1/mapproxy/service?SERVICE=WMS&amp;amp;REQUEST=GetMap&amp;amp;FORMAT=image/png&amp;amp;TRANSPARENT=TRUE&amp;amp;STYLES=&amp;amp;VERSION=1.1.1&amp;amp;LAYERS=topo&amp;amp;WIDTH=1584&amp;amp;HEIGHT=563&amp;amp;SRS=EPSG:900913&amp;amp;BBOX=-16818853.95026643,6075910,-9862030.049733568,8548569&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Nov 2012 17:08:41 GMT</pubDate>
    <dc:creator>JeremyWiebe</dc:creator>
    <dc:date>2012-11-01T17:08:41Z</dc:date>
    <item>
      <title>Sending token(s) to Non-ArcGIS WMS services</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sending-token-s-to-non-arcgis-wms-services/m-p/223972#M20837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We are using the ArcGIS v3.2 Javascript API.&amp;nbsp; Most of our mapping is done by ArcGIS, but we have a swappable base layer that we allow the user to change (aerial and satellite imagery or topography).&amp;nbsp; We are doing this using an esri.layers.WMSLayer().&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The service that is supplying this imagery is proxied through a mapproxy (&lt;/SPAN&gt;&lt;A href="http://mapproxy.org/"&gt;http://mapproxy.org/&lt;/A&gt;&lt;SPAN&gt;) server.&amp;nbsp; Some of these proxied layers we have to pay for per-request and require a user token with each request.&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been looking at the IdentityManager and IdentityManagerBase classes but from what I've read they're only applicable if you are using a secured ArcGIS server.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone have any ideas on how this might be done?&amp;nbsp;&amp;nbsp; I've tried embedding the tokens in the url when creating the WMSLayer but those are stripped when the javascript API starts calling out to the service.&amp;nbsp; Well, to be clear, the token remains in the first call to our proxy page (esri.config.defaults.io.proxyUrl) but is then gone when the API makes a direct call to the mapproxy service.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The request to the proxy page looks like this (I've removed the actual IP):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://localhost:47689/Map/Proxy.ashx?http://1.1.1.1/mapproxy/service?token=zzzzz&amp;amp;SERVICE=WMS&amp;amp;REQUEST=GetCapabilities"&gt;http://localhost:47689/Map/Proxy.ashx?http://1.1.1.1/mapproxy/service?token=zzzzz&amp;amp;SERVICE=WMS&amp;amp;REQUEST=GetCapabilities&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then the API goes directly to the proxied page:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://1.1.1.1/mapproxy/service?SERVICE=WMS&amp;amp;REQUEST=GetMap&amp;amp;FORMAT=image/png&amp;amp;TRANSPARENT=TRUE&amp;amp;STYLES=&amp;amp;VERSION=1.1.1&amp;amp;LAYERS=topo&amp;amp;WIDTH=1584&amp;amp;HEIGHT=563&amp;amp;SRS=EPSG:900913&amp;amp;BBOX=-16818853.95026643,6075910,-9862030.049733568,8548569"&gt;http://1.1.1.1/mapproxy/service?SERVICE=WMS&amp;amp;REQUEST=GetMap&amp;amp;FORMAT=image/png&amp;amp;TRANSPARENT=TRUE&amp;amp;STYLES=&amp;amp;VERSION=1.1.1&amp;amp;LAYERS=topo&amp;amp;WIDTH=1584&amp;amp;HEIGHT=563&amp;amp;SRS=EPSG:900913&amp;amp;BBOX=-16818853.95026643,6075910,-9862030.049733568,8548569&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 17:08:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sending-token-s-to-non-arcgis-wms-services/m-p/223972#M20837</guid>
      <dc:creator>JeremyWiebe</dc:creator>
      <dc:date>2012-11-01T17:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: Sending token(s) to Non-ArcGIS WMS services</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sending-token-s-to-non-arcgis-wms-services/m-p/223973#M20838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just a follow-up to my original question.&amp;nbsp; I found an alternate way to handle this.&amp;nbsp; The ArcGIS API will always hit the Proxy.ashx handler (we're on .NET) if we set the esri.config.defaults.io.proxyUrl setting.&amp;nbsp; So in the proxy handler I watch for GetCapabilities requests and rewrite the server URL's in the XML response to be routed through the proxy handler as well.&amp;nbsp; This works out well as we then have full control in the proxy handler to do whatever we want.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2012 15:49:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sending-token-s-to-non-arcgis-wms-services/m-p/223973#M20838</guid>
      <dc:creator>JeremyWiebe</dc:creator>
      <dc:date>2012-11-02T15:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sending token(s) to Non-ArcGIS WMS services</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sending-token-s-to-non-arcgis-wms-services/m-p/223974#M20839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am having the same problem and have solved it in another way. I am not sure which one I prefer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My approach is to subclass esri.layers.WMSLayer and override getImageUrl:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; getImageUrl: function (extent, width, height, callback) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // If applicable prefix with proxy url to let proxy handle authentication
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (esri.config.defaults.io.proxyUrl &amp;amp;&amp;amp; !this.proxyUrlPrefixed) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.getMapURL = esri.config.defaults.io.proxyUrl + "?" + this.getMapURL;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.proxyUrlPrefixed = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.inherited(arguments);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The same approach can be used for WMTSLayer by overriding getTileUrl.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone know the reason why WMSLayer and WMTSLayer do not call the proxy when requesting GetMap and GetTile?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:55:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sending-token-s-to-non-arcgis-wms-services/m-p/223974#M20839</guid>
      <dc:creator>JonasEngedal</dc:creator>
      <dc:date>2021-12-11T10:55:01Z</dc:date>
    </item>
  </channel>
</rss>

