Packagecom.esri.ags.components
Classpublic class IdentityManager
InheritanceIdentityManager Inheritance flash.events.EventDispatcher

Since : ArcGIS API 3.0 for Flex

The Identity Manager is a singleton class that, when enabled, will manage the credentials for ArcGIS Server resources secured using token-based authentication. It is also important to note that if signing in with credentials, Secure Socket Layer (SSL) should always be used for added security as it will encrypt data during transfer. For more information on customizing the window that is displayed when prompting a user to enter credentials, see the signInWindowClass property.

Note: Requires ArcGIS 10 SP1 for Server or later.

See also

ArcGIS Help - How ArcGIS Server security works
Live sample - Edit secure service


Public Properties
 PropertyDefined By
  currentSignInInfo : SignInInfo
[read-only] The information that can be used by a sign in window when the Identity Manager is challenging the user for their username and password.
IdentityManager
  enabled : Boolean
Set to true to enable the Identity Manager.
IdentityManager
  instance : IdentityManager
[static] [read-only] The single IdentityManager instance.
IdentityManager
  signInWindowClass : Class
The class to be created and shown using the PopUpManager so the user can log in.
IdentityManager
Public Methods
 MethodDefined By
  
findCredential(url:String, userId:String = null):Credential
Returns the credential for the resource identified by the specified url.
IdentityManager
  
Returns information about the server that is hosting the specified url.
IdentityManager
  
generateCredential(serverInfo:ServerInfo, username:String, password:String, responder:IResponder = null):AsyncToken
Returns a Credential object containing a token and its expiration time.
IdentityManager
  
getCredential(url:String, retry:Boolean = false, responder:IResponder = null):AsyncToken
Returns a Credential object that can be used to access the secured resource identified by the input url.
IdentityManager
  
registerServers(serverInfos:Array):void
Register secure servers and the token endpoints.
IdentityManager
  
Called by the sign-in window to provide a valid credential for the current resource.
IdentityManager
Events
 Event Summary Defined By
  Fires when the Identity Manager is about to challenge the user for their username and password.IdentityManager
Property Detail
currentSignInInfoproperty
currentSignInInfo:SignInInfo  [read-only]

The information that can be used by a sign in window when the Identity Manager is challenging the user for their username and password.


Implementation
    public function get currentSignInInfo():SignInInfo
enabledproperty 
enabled:Boolean

Set to true to enable the Identity Manager.

The default value is false.

This property can be used as the source for data binding.


Implementation
    public function get enabled():Boolean
    public function set enabled(value:Boolean):void

Example
IdentityManager.instance.enabled = true;
instanceproperty 
instance:IdentityManager  [read-only]

The single IdentityManager instance.


Implementation
    public static function get instance():IdentityManager
signInWindowClassproperty 
public var signInWindowClass:Class

The class to be created and shown using the PopUpManager so the user can log in.

Note: All the source code for the skins can be found in the ArcGIS API for Flex download. Once you unzip the api you can find the skins under the following directory 'ArcGIS_Flex/skins/src/com/esri/ags/skins' and the skin assets in the directory 'ArcGIS_Flex/skins/src/assets/skins'.

Copy the SignInWindow class to a project folder such as mySkins/supportClasses, rename such as CustomSignInWindow, and customize it as you see fit then set the signInWindowClass property on the IdentityManager class.

The default value is com.esri.ags.skins.supportClasses.SignInWindow.


Example
     IdentityManager.instance.signInWindowClass = mySkins.supportClasses.CustomSignInWindow;
     
Method Detail
findCredential()method
public function findCredential(url:String, userId:String = null):Credential

Returns the credential for the resource identified by the specified url. Optionally you can provide a userId to find credentials for a specific user.

Parameters

url:String — The url to a server.
 
userId:String (default = null) — The userId for which you want to obtain credentials.

Returns
Credential — the credential or null if not found.
findServerInfo()method 
public function findServerInfo(url:String):ServerInfo

Returns information about the server that is hosting the specified url.

Parameters

url:String — The url to a server.

Returns
ServerInfo — the server info.
generateCredential()method 
public function generateCredential(serverInfo:ServerInfo, username:String, password:String, responder:IResponder = null):AsyncToken

Returns a Credential object containing a token and its expiration time. You need to provide the ServerInfo object that contains token service URL and a username and password. This is a helper method typically called by sign-in windows to generate tokens.

Parameters

serverInfo:ServerInfo — A ServerInfo object that contains a token service URL.
 
username:String — The user's username.
 
password:String — The user's password.
 
responder:IResponder (default = null) — The responder to call on result or fault.

Returns
AsyncToken

See also

getCredential()method 
public function getCredential(url:String, retry:Boolean = false, responder:IResponder = null):AsyncToken

Returns a Credential object that can be used to access the secured resource identified by the input url. If required the user will be challenged for a username and password which is used to generate a token. Note: The Identity Manager sets up a timer to update the Credential object with a new token prior to the expiration time. This method is typically called by the BaseTask when a request fails due to an "invalid credentials" error.

Parameters

url:String — The url for the secure resource.
 
retry:Boolean (default = false) — Determines if the method should make an additional attempt to get the credential after a failure.
 
responder:IResponder (default = null) — The responder to call on result or fault.

Returns
AsyncToken

See also

registerServers()method 
public function registerServers(serverInfos:Array):void

Register secure servers and the token endpoints. The Identity Manager uses the rest/info resource to determine the location of the token endpoint so in most cases calling registerServers is not necessary. However if the location of your server or token endpoint is non-standard, then use this method to register the location.

Parameters

serverInfos:Array — An Array of ServerInfo objects that defines the secure service and token endpoint.

See also

setCredentialForCurrentSignIn()method 
public function setCredentialForCurrentSignIn(credential:Credential):void

Called by the sign-in window to provide a valid credential for the current resource. The sign-in window should pass in null if it's unable to generate a valid credential.

Parameters

credential:Credential — the credential for the current resource or null if one can not be provided.

See also

Event Detail
showSignInWindow Event
Event Object Type: com.esri.ags.events.IdentityManagerEvent
IdentityManagerEvent.type property = com.esri.ags.events.IdentityManagerEvent.SHOW_SIGN_IN_WINDOW

Fires when the Identity Manager is about to challenge the user for their username and password. This event is cancelable by calling event.preventDefault() which will stop the signInWindowClass from being opened. It's then the application's responsibility to challenge the user and call setCredentialForCurrentSignIn().

Defines the value of the type property of an showSignInWindow event object.

See also