AnsweredAssumed Answered

SAML SSO in Javascript app

Question asked by stassara on May 14, 2019
Latest reply on Jan 21, 2020 by astha_carter

Hi all,

I'm having a hard time figuring out how to achieve a Single Sign On experience from a JS application. Let me explain in detail my situation:

 

  • Portal for ArcGIS 10.4.1 federated with an ArcGIS Server 10.4.1
  • Identity has been federated:
  • In Portal I have created a group and added some users to that group
  • I created a Tile Layer item based on an ArcGis Server Map Service and I shared it with the above-mentioned group
  • I created a new Javascript application that:
    • Authenticates against the IdentityServer and obtains an access token from that
    • References the ArcGIS Javascript API 4.11 to show a map
    • Adds the Tile Layer item to the map

 

What I got until now is the ESRI authentication dialog appearing as soon as I load the tile layer.

What I want is to access the Tile Layer using the token that I obtained from the IdentityServer, without the user having to sign in again.

 

Here is the JS code I use to display the map and the Tile Layer:

 

    var map = new Map({

        layers: [new TileLayer({url: basemapUrl})]});

 

    var view = new MapView({

        container: "viewDiv",

        map: map

    });

 

    esriConfig.portalUrl = 'http://atlhqmvmsdev4.eusc.europa.eu/arcgis';

 

    var portal = new Portal({ isPortal: true });

    portal.authMode = "auto";

    portal.load().then(function () {

        Layer.fromPortalItem({

            portalItem: {

                id: "1b4c51aa3feb42bba71ae02195e03f75" // ID of the Tile Layer item

            }

        })

        .then(function (layer) {

            map.add(layer);

        })

    });

 

    mgr.getUser().then(function (user) {

        esriId.registerToken({

            token: user.access_token,

            server: portalUrl

        });

    });

 

What am I missing? Any hint or clarification is very welcome!

Outcomes