Combine secure and unsecure services in Web AppBuilder

695
4
11-08-2016 08:44 AM
BlakeTerhune
MVP Regular Contributor

I'd like to have a single app in WAB that contains both secured and unsecured services all from our ArcGIS Server that has integrated AD authentication. In my first attempt, WAB just popped up a log in as soon as the app was loaded. I would like to have all of these services together in the same app but only ask/attempt to log in if one of the secured services is turned on in the layer list. Any ideas how I can accomplish this either with built-in functionality or some custom code after downloading the app?

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Blake,

  Unfortunately if there is a secure service added to the app then the app will challenge for credential immediately and not wait for the layer to be visible. There is no way to change this that I know of unless you delay the adding of that secure layer to the map some how.

BlakeTerhune
MVP Regular Contributor

Always crushing my dreams. Thanks, Robert.

0 Kudos
deleted-user-CQZbjNeBXm49
Occasional Contributor III

Blake,

Have you tried the AddLayer Widget developed by David McCourt (Softwhere), which allows you to add additional layers into your map, this can help with the suggestion Robert made about "delay the adding of that secure layer ". You can use this widget as the base for the secure services, that is what I do and had recommend.

Baba

BlakeTerhune
MVP Regular Contributor

It appears that this may be possible. Although it didn't work while the app was running in Web AppBuilder, I decided to shoot the moon and download and host the app anyway and it seems to work exactly like I hoped! We have integrated AD authentication and a proxy for ArcGIS Online. The app magically shows the secured service if the person is in the AD group allowed access to it from ArcGIS Server. If the person is not in the group, then the service is not displayed in the layer list and it never asks for a login because it already has it with the integrated AD authentication. When I check the console log there is an entry where it tried to get the service but gets denied access because user does not have permissions.

Error: User does not have permissions to access 'appname/servicename.mapserver'.
   {
      [functions]: ,
      __proto__: { },
      code: 403,
      description: "",
      details: [ ],
      httpCode: 403,
      log: undefined,
      message: "User does not have permissions to access 'appname/servicename.mapserver'.",
      name: "Error",
      number: 0,
      subcode: 2
   }