<?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 Re: Secured services and the proxy page -- please help! in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-services-and-the-proxy-page-please-help/m-p/314282#M28911</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the assistance; however, I'm just not getting it.&amp;nbsp; I think if you could help me access a token from my server it will put me in the right direction.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How is this request formatted?&amp;nbsp; I am trying to use the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="http://" rel="nofollow" target="_blank"&gt;http://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;MyServer&amp;gt;/ArcGIS/tokens?request=gettoken&amp;amp;username=&amp;lt;MyUser&amp;gt;&amp;amp;password=&amp;lt;MyPass&amp;gt;&amp;amp;clientid="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://" rel="nofollow" target="_blank"&gt;http://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;MyServer&amp;gt;&amp;amp;expiration=1440&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As always your help is appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Sep 2011 19:27:06 GMT</pubDate>
    <dc:creator>JamesWhisenhunt</dc:creator>
    <dc:date>2011-09-21T19:27:06Z</dc:date>
    <item>
      <title>Secured services and the proxy page -- please help!</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-services-and-the-proxy-page-please-help/m-p/314279#M28908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to consume some of my secured services.&amp;nbsp; I can so this without a problem by hard coding the token into my url as below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;new esri.layers.ArcGISDynamicMapServiceLayer(&amp;lt;my Map Service&amp;gt; + "?token=" + &amp;lt;my Token&amp;gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a pain to keep replacing the token and anyone can view the page regardless of credentials.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have included these 2 lines of code into my html.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; esri.config.defaults.io.proxyUrl = "/proxy/proxy.ashx";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; esriConfig.defaults.io.alwaysUseProxy = true; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I assume that I call the maps service as normal; however, I have tried it several ways.&amp;nbsp; Whenever I launch my application I get returned in firebug:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;"NetworkError: 403 Forbidden - &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://maps.bgadd.org/proxy/proxy.ashx?http://maps.bgadd.org/esri_sde/rest/services/temp/BaseTest/MapServer?f=json&amp;amp;dpi=96&amp;amp;transparent=true&amp;amp;format=png8&amp;amp;callback=dojo.io.script.jsonp_dojoIoScript1._jsonpCallback" rel="nofollow" target="_blank"&gt;http://maps.bgadd.org/proxy/proxy.ashx?http://maps.bgadd.org/esri_sde/rest/services/temp/BaseTest/MapServer?f=json&amp;amp;dpi=96&amp;amp;transparent=true&amp;amp;format=png8&amp;amp;callback=dojo.io.script.jsonp_dojoIoScript1._jsonpCallback&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone have any ides?&amp;nbsp; Any help is greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Sep 2011 20:10:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-services-and-the-proxy-page-please-help/m-p/314279#M28908</guid>
      <dc:creator>JamesWhisenhunt</dc:creator>
      <dc:date>2011-09-15T20:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Secured services and the proxy page -- please help!</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-services-and-the-proxy-page-please-help/m-p/314280#M28909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi James, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have encountered this situation in the past and found one way that the problem can be solved is by obtaining the dynamic token at the server and writing it to a Javascript variable in the page which can dynamically be used by appending it to your MapService URL's just like you have in your post.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example; in your main default.aspx.cs page (or similar) you can use a function like the following to get a valid token:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;protected const string TOKEN_URL_TEMPLATE = @"{0}://{1}/arcgis/tokens?request=gettoken&amp;amp;username={2}&amp;amp;Password={3}&amp;amp;clientid={4}&amp;amp;expiration={5}";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;public string UserToken = "INVALID SSO TOKEN OR FAILED LOGIN.";&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;protected string getUserRoleToken(string username)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; string s = "";&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; WebClient client = new WebClient();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(bypassAllCertificateStuff);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; string tokenRequestUrl = String.Format(TOKEN_URL_TEMPLATE, "https", ESRI_MAP_SERVER, username, "PASSWORD", "", 1440);//1440 is the token lifetime&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; // Add a user agent header in case the &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // requested URI contains a query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Stream data = client.OpenRead(tokenRequestUrl);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; StreamReader reader = new StreamReader(data);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; s = reader.ReadToEnd();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; data.Close();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; reader.Close();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; UserToken=s;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; return s;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//This Method is needed to avoid errors when you are using a self-signed certificate&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;private static bool bypassAllCertificateStuff(object sender, X509Certificate cert, X509Chain chain, System.Net.Security.SslPolicyErrors error)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; return true;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After generating a token, you can include it in your page:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;djConfig = {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; parseOnLoad: true,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; baseUrl:'./',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; isDebug: false,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; usePlainJson: true,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; locale: 'en'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;};&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var userToken = '&amp;lt;% Response.Write(UserToken);%&amp;gt;';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;___________________________________________________&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Once you have done the above, you can utilise the userToken JS variable in your map service urls eg:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;new esri.layers.ArcGISDynamicMapServiceLayer(&amp;lt;my Map Service&amp;gt; + "?token=" + userToken);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#################################&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With all of that in place you have the beginnings of a framework that can request authentication directly from the web-page user and relay that to the server in a secure/third-party or federated way.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I Hope this helps&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne Lee-Archer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Senior Consultant - Professional Services&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ESRI Australia (ACT).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Sep 2011 03:24:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-services-and-the-proxy-page-please-help/m-p/314280#M28909</guid>
      <dc:creator>WayneLee-Archer</dc:creator>
      <dc:date>2011-09-16T03:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Secured services and the proxy page -- please help!</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-services-and-the-proxy-page-please-help/m-p/314281#M28910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;James,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;JS API 2.5 will have a new widget called identity manager, which would solve the issue. Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Sep 2011 17:09:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-services-and-the-proxy-page-please-help/m-p/314281#M28910</guid>
      <dc:creator>JianHuang</dc:creator>
      <dc:date>2011-09-19T17:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Secured services and the proxy page -- please help!</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-services-and-the-proxy-page-please-help/m-p/314282#M28911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the assistance; however, I'm just not getting it.&amp;nbsp; I think if you could help me access a token from my server it will put me in the right direction.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How is this request formatted?&amp;nbsp; I am trying to use the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="http://" rel="nofollow" target="_blank"&gt;http://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;MyServer&amp;gt;/ArcGIS/tokens?request=gettoken&amp;amp;username=&amp;lt;MyUser&amp;gt;&amp;amp;password=&amp;lt;MyPass&amp;gt;&amp;amp;clientid="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://" rel="nofollow" target="_blank"&gt;http://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;MyServer&amp;gt;&amp;amp;expiration=1440&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As always your help is appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 19:27:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-services-and-the-proxy-page-please-help/m-p/314282#M28911</guid>
      <dc:creator>JamesWhisenhunt</dc:creator>
      <dc:date>2011-09-21T19:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Secured services and the proxy page -- please help!</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-services-and-the-proxy-page-please-help/m-p/314283#M28912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you checked if web application proxy run Ok?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You can open web application proxy in VS and debug using parameter url seen in fliddler so you can see error.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 15:48:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-services-and-the-proxy-page-please-help/m-p/314283#M28912</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2011-09-22T15:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Secured services and the proxy page -- please help!</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-services-and-the-proxy-page-please-help/m-p/314284#M28913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks everyone for the help.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My problem with requesting a token was I have a # sign in the password I was using.&amp;nbsp; I believe this is a HTML reserved character.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone know a work around other than changing passwords.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the help,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 20:19:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-services-and-the-proxy-page-please-help/m-p/314284#M28913</guid>
      <dc:creator>JamesWhisenhunt</dc:creator>
      <dc:date>2011-09-22T20:19:53Z</dc:date>
    </item>
  </channel>
</rss>

