| Package | com.esri.bao.tasks.authentication |
| Class | public final class AuthenticationTask |
| Inheritance | AuthenticationTask AbstractTask flash.events.EventDispatcher |
See also
| Property | Defined By | ||
|---|---|---|---|
![]() | concurrency : String
Value that indicates how to handle multiple calls to the same task. | AbstractTask | |
![]() | disableClientCaching : 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 | |
![]() | proxyURL : String
The URL to proxy the request through. | AbstractTask | |
![]() | requestTimeout : Number
The request timeout in seconds. | AbstractTask | |
![]() | showBusyCursor : Boolean
If true, a busy cursor is displayed while a service is executing. | AbstractTask | |
| token : String [override]
Authentication token received during the last execution of this task. | AuthenticationTask | ||
![]() | url : String
URL of the task. | AbstractTask | |
| Method | Defined 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 | ||
| Event | Summary | Defined 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 | |||
| Constant | Defined By | ||
|---|---|---|---|
| name : String = authentication [static] Task name. | AuthenticationTask | ||
| token | property |
token:String[override] Authentication token received during the last execution of this task.
public function get token():String public function set token(value:String):void| 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.
Parametersurl:String — The base URL to the Business Analyst Online REST Authentication Service.
|
| execute | () | method |
public function execute(username:String, password:String, responder:IResponder = null):AsyncTokenSends 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.
|
AsyncToken — Asynch token associated with the response.
|
| fault | Event |
mx.rpc.events.FaultEventmx.rpc.events.FaultEvent.FAULTThe fault event is dispatched when an asynchronous execution of a Business Analyst task fails.
| taskCompleted | Event |
com.esri.bacore.BATaskCompletedEventcom.esri.bacore.BATaskCompletedEvent.COMPLETEThe taskCompleted event is dispatched when an asynchronous execution of a Business Analyst task completes successfully.
The BATaskCompletedEvent.COMPLETE constant defines the value of thetype property of the event object for a taskCompleted event.
The properties of the event object have the following values:
| Property | Value |
|---|---|
babbles | false |
cancelable | false |
currentTarget | The Object that defines the event listener that handles the event. |
target | The BATask object that dispatched the event. This is an instance of a Business Analyst task that was executed. |
taskName | Name of a Business Analyst task that was executed. |
result | Task execution result object. |
messages | Optional 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.
| name | Constant |
public static const name:String = authenticationTask name.
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));