Packagecom.esri.bao.tasks.authentication
Classpublic final class AuthenticationTask
InheritanceAuthenticationTask Inheritance AbstractTask Inheritance flash.events.EventDispatcher

The AuthenticationTask class is used to get a string-based response containing a short-lived token. This token, while valid, may be used in the token property of Business Analist Online tasks inheriting from the BAOnlineTask class.


Example
ActionScript to get a string-based response containing a short-lived token. This token, while valid, may be used in the token property of Business Analist Online tasks inheriting from the BAOnlineTask class.
    
 var task:AuthenticationTask = new AuthenticationTask();
 
 // "https://baoapi.esri.com" is the default value for the AuthenticationTask url.
 //task.url = "https://baoapi.esri.com";
 
 task.execute(username, password, new Responder(resultHandler, faultHandler));
 
 

See also

BAOnlineTask


Public Properties
 PropertyDefined by
 Inheritedconcurrency : String
Value that indicates how to handle multiple calls to the same task.
AbstractTask
 InheriteddisableClientCaching : Boolean
If true, adds a timestamp parameter ("_ts") to the REST request to prevent the request from being loaded from the browser's cache.
AbstractTask
 InheritedproxyURL : String
The URL to proxy the request through.
AbstractTask
 InheritedrequestTimeout : Number
The request timeout in seconds.
AbstractTask
 InheritedshowBusyCursor : Boolean
If true, a busy cursor is displayed while a service is executing.
AbstractTask
  token : String
Authentication token received during the last execution of this task.
AuthenticationTask
 Inheritedurl : String
URL of the task.
AbstractTask
Public Methods
 MethodDefined by
  
AuthenticationTask(url:String)
Creates a new instance of the AuthenticationTask class.
AuthenticationTask
  
execute(username:String, password:String, responder:IResponder = null):AsyncToken
Sends a request to the authentication service for getting a short-lived authentication token.
AuthenticationTask
Events
 EventSummaryDefined by
   The fault event is dispatched when an asynchronous execution of a Business Analyst task fails.AuthenticationTask
   The taskCompleted event is dispatched when an asynchronous execution of a Business Analyst task completes successfully.AuthenticationTask
Public Constants
 ConstantDefined by
  name : String = "authentication"
[static] Task name.
AuthenticationTask
Property detail
tokenproperty
token:String  [read-write]

Authentication token received during the last execution of this task.

Implementation
    public function get token():String
    public function set token(value:String):void
Constructor detail
AuthenticationTask()constructor
public function AuthenticationTask(url:String)

Creates a new instance of the AuthenticationTask class.

The base URL for the Business Analyst Online authentication Web Service looks as follows:

https://{host}:{port}

The {host} and {port} parameters in this URL should be substituted with valid Business Analyst Online host name and port, respectively.

If the base URL is null or empty, the "https://baoapi.esri.com" value is assigned as the base URL.

Parameters
url:String — The base URL to the Business Analyst Online REST Authentication Service.
Method detail
execute()method
public function execute(username:String, password:String, responder:IResponder = null):AsyncToken

Sends a request to the authentication service for getting a short-lived authentication token.

A response can be received in two ways—in an optional responder object passed in parameters of this method and/or in listeners of fault and taskCompleted events registered for this task.

The responder is notified first when a response is received and parsed. Its fault method receives a parameter of the FaultEvent type and its result method receives a parameter of the BATaskCompletedEvent type whose result property contains the authentication token received. After that the received event is dispatched to the listeners of this task.

If response is succesfully received and parsed, a new authentication token is saved in the token property of this task.

Parameters
username:String — Valid Business Analyst Online REST API user name.
 
password:String — User password.
 
responder:IResponder (default = null) — A responder to call on result or fault.

Returns
AsyncToken — Asynch token associated with the response.
Event detail
faultevent 
Event object type: mx.rpc.events.FaultEvent

The fault event is dispatched when an asynchronous execution of a Business Analyst task fails.

taskCompletedevent  
Event object type: com.esri.bacore.BATaskCompletedEvent
BATaskCompletedEvent.type property = com.esri.bacore.BATaskCompletedEvent.COMPLETE

The taskCompleted event is dispatched when an asynchronous execution of a Business Analyst task completes successfully.

The BATaskCompletedEvent.COMPLETE constant defines the value of the type property of the event object for a taskCompleted event.

The properties of the event object have the following values:

PropertyValue
babblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event.
targetThe BATask object that dispatched the event. This is an instance of a Business Analyst task that was executed.
taskNameName of a Business Analyst task that was executed.
resultTask execution result object.
messagesOptional array of TaskMessage objects received.

The currentTarget and target properties are specified after the event was dispatched. A responder object passed in parameters of a Business Analyst task execute method receives the event before it is dispatched.

Constant detail
nameconstant
public static const name:String = "authentication"

Task name.