AnsweredAssumed Answered

How to modify our proxy so it allows the default printing service to print secured services?

Question asked by michaellodes on Apr 17, 2018
Latest reply on May 3, 2018 by bsvensson-esristaff

As in the title. We are logging in our users with the .dotnet resource Proxy hosted on our server. But when trying to print secured services the user is prompted to log in anyway. 

As discussed in an older post, that's the intended behaviour.


The resource proxy will not print a secured map service. This is by design. So it is possible to use the proxy in order to authenticate and display the secured service on the map, but when it comes to printing a secured service, the resource proxy will not handle this scenario as it will not pass the token in the Web_Map_as_JSON parameter.… 


I spoke with the Print widget guys at the UC in San Diego a few weeks ago (June/July 2016). They told me that in order for the print service to work, the proxy must be changed so that it will add a token on to a JSON output from the client side app. Currently, as stated above, the proxy will see the request from the print widget go through, but it will not attach a token to it. It is not the easiest solution, but it is the way to go. 




NOTE: These would only work for the DotNet version of the Esri resource proxy.


  1. Get the "Web_Map_as_JSON" (WMAJ) parameter (and data it contains) from the the request. 
  2. Using a library like Newtonsoft.Json, deserialize the WMAJ data from a JSON object into a DotNet Object
  3. Get the "Operational Layers" section of the WMAJ object and add each layer into an array.
  4. Compare the Layer URL's of the layers from the WMAJ object and the URL's that are defined in the proxy.config file.
  5. If a layer's URL matches a URL from the proxy config file, use the credential info to generate a token for it.
  6. Apply the token to the layer in the array of "Operational Layers"
  7. Serialize the DotNet WMAJ object (now with tokens for the secured layers) and send the request on its way.


I include the print task URL in the app's config.json file and the proxy's proxy.config file. 


The possible solution above seems to be really difficult. We can't create a custom print service, since we don't want to use arg gis server. 

So since some time passed since then, i wanted to ask if this is possible by now, or if someone already did these proxy modifications.



Michael Lodes