Javascript Secure Services - No Log In

4463
9
Jump to solution
06-15-2015 11:06 AM
LauraMiles1
Occasional Contributor III

Hi there,

We had something working in Silverlight where users on our domain would not have to sign in via a dialog to access secured services. We are transitioning our site to Javascript, and we'd like to have the same. Some of our layers are secured while most are not, and we'd prefer that this is somehow read from the users' windows logins as it was in Silverlight (at least in IE). Is this possible? I can't seem to find any info on authentication that bypasses the sign in dialog altogether.

We are using Javascript 3.13, ArcGIS for Server 10.3.1.

Thanks

0 Kudos
1 Solution
9 Replies
LauraMiles1
Occasional Contributor III

Hi Jake,

Thanks for the links. Do you know the difference between using the PHP, .Net, or Java proxies? When would you use a particular one? This is a bit out of my field of expertise.

Thanks

0 Kudos
JakeSkinner
Esri Esteemed Contributor

Your Web server must support one of these server-side platforms in order to use the proxy page.  I don't really have any experience with Java or PHP.  However, my current server is running IIS with ASP.NET configured:

screen1.PNG

So, when setting up a proxy I use the .NET version.

MichaelAugust
Occasional Contributor III

Hi Jake - could you possibly point me to some working examples/documentation of what the proxy.config and config.json files are supposed to contain at a minimum for a webappbuilder dev edition webapp that I create and then download (host on my machine).  I can't seem to get the proxy to function (or log to .txt file either) locally i.e., http://localhost/[mywebapp] with the .NET proxy set up. 

The documentation doesn't really provide many examples and I'm fairly new to .NET applications in general, thanks!

0 Kudos
JakeSkinner
Esri Esteemed Contributor

Hi Michael,

Sure thing.  I went ahead and created a Web Appbuilder app called 'ProxyExample'.  The web map that the application is using is shared with Everyone, but the hosted service is only shared with the Organization.

In the config.json, I set the httpProperty to the following:

"httpProxy" : {
        "useProxy" : true,
        "url" : "http://testServer.esri.com/proxyexample/proxy/proxy.ashx",
        "alwaysUseProxy" : true,        
        "rules" : []
    }

I copied the .NET proxy to my application directory in a folder called 'proxy'.  I then set the proxy.config file to the following:

<?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig mustMatch="true" logFile="C:\Temp\Shared\proxy_logs\auth_proxy.log">
  <serverUrls>
      <serverUrl url="http://services.arcgis.com/Fz6BBJUji5ArUSDM/arcgis/rest/services/"
            username="user1"
            password="pass1"
            matchAll="true">
      </serverUrl>
      <serverUrl url="http://epro.maps.arcgis.com/" matchAll="true"></serverUrl>
      <serverUrl url="http://geocode.arcgis.com/arcgis/rest/" matchAll="true"></serverUrl>
      <serverUrl url="http://server.arcgisonline.com/ArcGIS/rest/" matchAll="true"></serverUrl>
      <serverUrl url="http://services.arcgisonline.com/ArcGIS/rest/" matchAll="true"></serverUrl>
      <serverUrl url="http://serverapi.arcgisonline.com/jsapi/" matchAll="true"></serverUrl>      

  </serverUrls>
</ProxyConfig>

The first URL is to the ArcGIS Online hosted service, followed by the username and password.  The second URL is to my ArcGIS Online Organization.  The remaining URLs are to services my application are using (i.e. Geocoding, Basemaps).

I am then able to access the application by going to:

http://testServer.esri.com/proxyexample

When accessing the application, I will not be prompted for a username/password to access the hosted service.

BjornSvensson
Esri Regular Contributor

Laura Miles

The PHP, .Net, or Java proxies are functionally equivalent. Which one to pick depends primarily on what type of web server you are using. If you are using IIS as your webserver, using the .Net proxy is the easiest to set up.

nicogis
MVP Frequent Contributor
if you need more flexibility, 
you can develop a soi in c# or java (server object interceptor) and 
create a service and by user to display 
the individual layers in the service.
In sdk 10.3.1 see the example NetLayerAccessSOI
Important: with soi you don't need change logic/code on your client
0 Kudos
LauraMiles1
Occasional Contributor III

Hi Domenico, I actually do want to use SOI's eventually but haven't been able to find much documentation. I tried searching NetLayerAccessSOI but couldn't find any documentation. Could you post a link?

0 Kudos
nicogis
MVP Frequent Contributor

if you have installed sdk arcobject for .net or java you can see the examples:

in net:

C:\Program Files (x86)\ArcGIS\DeveloperKit10.3\Samples\ArcObjectsNet\

the folders are

ServerApplyWatermarkSOI (sample add watermark after operation 'export')

ServerSimpleLoggerSOI (sample for logging request from client)

ServerLayerAccessSOI (sample layer level controls and conditionally give access to certain layers based on an external permissions file)

ServerOperationAccessSOI (sample how to filter access to individual operations available on the map server)

in java:

C:\Program Files (x86)\ArcGIS\DeveloperKit10.3\java\samples\arcobjects\serverobjectinterceptors

In help of visual studio (sdk arcobjects .net) or eclipse (sdk arcobjects.java) you have the documentation for develop in detail

Here you have code practices Coding practices for extensions—Documentation (10.3 and 10.3.1) | ArcGIS for Server

In my blog you can see a post about soi NicoGis - Sviluppare in ambiente ArcGIS...: Tutti pazzi per il SOI

if you have more questions I have already developed soi so I can help you in details