Hide Table of Contents
esri
Map
toolbars
Class: IdentityManager
[ AMD Module Require | Legacy Module Require ]

Module Require

require(["esri/IdentityManager", ... ], function(IdentityManager, ... ){ ... });

Description

Class added 2.5
This singleton class is automatically instantiated into esri.id when the module containing this class is imported into the application. This class extends esri.IdentityManagerBase and inherits the base class properties and methods. This class provides the framework and helper methods required to implement a solution for managing user credentials for the following resources:
  • ArcGIS Server resources secured using token-based authentication. Note that only ArcGIS Server versions 10 SP 1 and greater are supported.
  • Secured ArcGIS.com resources (i.e. web maps).

If your application accesses services from different domains then it's a cross-domain request and so you need to setup a proxy or use CORS (if supported by browser). If CORS is supported the Identity Manager knows to make a request to the token service over https.

Internet Explorer (7-9) do not support CORS so the token request has to go through a proxy hosted on the same-origin as the application (identical protocol, hostname and port). Authentication requests over http are prevented because sensitive data sent via GET can be viewed in server logs. To prevent this the Identity Manager requires that you use POST over https to ensure your credentials are secure. View the 'Using a proxy' and 'CORS' sections in the Inside esri.request help topic for more details.

You can access the dialog box used by the IdentityManager using this code:
  var dialog = dijit.byNode(dojo.query(".esriSignInDialog")[0]);

Samples

Search for samples that use this class.

Class hierarchy

esri.IdentityManager

CSS

CSS ClassDescription
esriSignInDialogCSS class name for the dialog assigned to the IdentityManager. Use this CSS class when defining CSS style rules to customize the look and feel of the dialog box.

Properties

PropertyTypeDescription
dialogdijit.DialogDialog box widget used to challenge the user for their credentials when the application attempts to access a secure resource. This property is available after the onDialogCreate event has fired.

Methods

MethodReturn ValueDescription
signIn()dojo.DeferredThis method is called by the base identity manager implementation.

Events

[ On Style Events | Connect Style Events ]

All On Style event listeners receive a single event object. The event properties listed below are accessed from this event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.
On EventEvent PropertiesDescription
dialog-cancel<Object> infoFired when the user clicks the cancel button on the dialog box widget. This event can be used to add custom logic when the user cancels the sign-in process. Should be used in favor of onDialogCancel
dialog-createNoneFired when the dialog box widget, used to prompt users for their credentials, is created. Should be used in favor of onDialogCreate
Property Details

<dijit.Dialog> dialog

Dialog box widget used to challenge the user for their credentials when the application attempts to access a secure resource. This property is available after the onDialogCreate event has fired. (Added at v2.6)
See Also: onDialogCreate
Method Details

signIn()

This method is called by the base identity manager implementation. When invoked, this method will do the following:
  • Display a modal dialog box for the application end-user to enter username and password.
  • Generate a token and creates a Credential object.
  • Return the Credential object to the caller (IdentityManagerBase) via a Deferred object.
Return Value: dojo.Deferred
Event Details

[ On Style Events | Connect Style Events ]

dialog-cancel

Fired when the user clicks the cancel button on the dialog box widget. This event can be used to add custom logic when the user cancels the sign-in process. Should be used in favor of onDialogCancel (Added at v3.5)
Event Properties:
<Object> infoAn object with the following properties: <String> resourceUrl URL of the secured resource for which the sign-in process was cancelled. <ServerInfo> serverInfo A ServerInfo object describing the server where the secure resource is hosted.

dialog-create

Fired when the dialog box widget, used to prompt users for their credentials, is created. Should be used in favor of onDialogCreate (Added at v3.5)