Packagecom.esri.bacore.client
Classpublic class TokenProvider
InheritanceTokenProvider Inheritance Object
Implements ITokenProvider, flash.utils.IExternalizable
Subclasses ArcGISTokenProvider, BAOnlineTokenProvider, BAServerTokenProvider

The TokenProvider class provides the abstract implementation of the ITokenProvider interface based on an authentication task.

Subclasses of this class must implement the "abstract" authenticationTask property and the execute method. The populateUserInfo hook is applied just before requesting user credentials in order to prepare a userInfo object to be passed to IAuthentication instance.

See also

ITokenProvider
IAuthentication
AbstractTask


Public Properties
 PropertyDefined By
  authenticationTask : AbstractTask
[read-only] Authentication task associated with this token provider.
TokenProvider
  currentToken : String
Current authentication token.
TokenProvider
  proxyURL : String
The URL to proxy the request through.
TokenProvider
  url : String
Authentication service URL.
TokenProvider
Public Methods
 MethodDefined By
  
TokenProvider(authentication:IAuthentication = null)
Creates a new instance of the TokenProvider type.
TokenProvider
  
updateToken(responder:IResponder):void
Requests an authentication service for getting a new security token.
TokenProvider
Protected Methods
 MethodDefined By
  
execute(userCredentials:Object, responder:IResponder):void
Executes the authentication task.
TokenProvider
  
populateUserInfo(userInfo:Object):void
Populates the userInfo object with properties to be passed to the IAuthentication object.
TokenProvider
Property Detail
authenticationTaskproperty
authenticationTask:AbstractTask  [read-only]

Authentication task associated with this token provider. This property is "abstract". Its default implementation throws an error.


Implementation
    public function get authenticationTask():AbstractTask
currentTokenproperty 
currentToken:String

Current authentication token.

This property is the proxy to the authentication task token property. In an authentication task, the "token" property is not passed to an authentication service. Instead of this, the "token" property is used as a storage for the current token. When the authentication task successfully executes the authentication method, it must update its "token" property with the new value of token.


Implementation
    public function get currentToken():String
    public function set currentToken(value:String):void
proxyURLproperty 
proxyURL:String

Since : Community Analyst API for Flex 2.2.

The URL to proxy the request through.


Implementation
    public function get proxyURL():String
    public function set proxyURL(value:String):void
urlproperty 
url:String

Authentication service URL.


Implementation
    public function get url():String
    public function set url(value:String):void
Constructor Detail
TokenProvider()Constructor
public function TokenProvider(authentication:IAuthentication = null)

Creates a new instance of the TokenProvider type.

Parameters
authentication:IAuthentication (default = null) — An object used for getting user credentials.
Method Detail
execute()method
protected function execute(userCredentials:Object, responder:IResponder):void

Executes the authentication task. This method is "abstract". Its default implementation throws an error.

Parameters

userCredentials:Object — An object containing user credentials passed to the authentication task.
 
responder:IResponder — A responder.

populateUserInfo()method 
protected function populateUserInfo(userInfo:Object):void

Populates the userInfo object with properties to be passed to the IAuthentication object. The default implementation does nothing. On input, the userInfo object contains the "url" property value with the authentication task URL.

Parameters

userInfo:Object — User info object.

updateToken()method 
public function updateToken(responder:IResponder):void

Requests an authentication service for getting a new security token.

If the token service fails to get a new token, the responder.fault method is called with an instance of the mx.rpc.events.FaultEvent type. If the token service returns a new security token, the currentToken property is updated with the new token value and after that the responder.result method is called with with the new token passed in the first parameter.

Parameters

responder:IResponder — Responder object to be notified on a response from the token service.