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

2594
8
04-17-2018 05:24 AM
MichaelLodes2
Occasional Contributor

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.

https://community.esri.com/message/647796-re-web-appbuilder-arcgis-online-layer-print-issue?commentI... 

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.

https://community.esri.com/thread/174867#comment-620278 

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. 

https://community.esri.com/thread/174867#comment-688539 

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.

Sincerely,

Michael Lodes

8 Replies
RobertScheitlin__GISP
MVP Emeritus

Michael,

   No there has been no change to this that I know of.

LarsSchmitz
Occasional Contributor III

Thanks for posting your question, Michael Lodes! I hope the community can help. Any idea,‌raul.jimenezesri-es-esridist‌, jorge.barrachinaesri-es-esridist‌, mjagtesri-nl-esridist‌, RRubalcava-esristaff‌?

0 Kudos
Raul_Jimenez
Esri Contributor

mmm I have not idea but I think bsvensson-esristaff can help us here .

Good luck!

JorgeBarrachina_Gutiérrez
New Contributor II

Sorry, I don't know too l.schmitzesri-de-esridist

0 Kudos
Raul_Jimenez
Esri Contributor

Michael Lodes‌ I would recommend you to try to reach the people involved in the development through the Github issues of the project -> Issues · Esri/resource-proxy · GitHub , they might not have the GeoNet notifications enabled.

Cheers

LarsSchmitz
Occasional Contributor III

That is a good hint indeed, Raúl Jiménez Ortega‌. I think Rene Rubalcava is a good starting point 

MichaelLodes2
Occasional Contributor

Thank you all for your answers 🙂

BjornSvensson
Esri Regular Contributor

Michael Lodes‌ 
No there hasn't been any changes in the resource proxy to support this. The preferred way is to use a custom print service. I'll respond on your github issue as well with some more details..