SAML SSO in Javascript app

1959
1
05-14-2019 09:20 AM
StefanoTassara
New Contributor

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!

Tags (3)
1 Reply
AsthaDevra1
New Contributor II

Hi,

Did you get this issue fixed ? I am having the same problem with ESRI Federated Server.

Thanks,

Astha

0 Kudos