Authenticating A User To The Application Server - MACROMEDIA FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 Use Manual

Using flash remoting for flash mx 2004 actionscript 2.0
Table of Contents

Advertisement

Setting a default gateway URL provides you with the greatest flexibility in both development and
deployment. It lets you provide a URL that works when you test your SWF file directly in the
Flash development environment. Setting a gateway URL also lets you override the default value
with a server-specific gateway that you specify in the web page when you deploy your SWF file.
Note: If you specify
Flash application from outside the Flash development environment or Macromedia Flash Player,
Flash Remoting does not use localhost as the default gateway host. Instead, it replaces
and any port specified in the
the Flash application. For example, if you specify http://localhost/flashservices/gateway in the
setDefaultGatewayUrl()
apps.mycompany.com:8500/flashapps/myapp.swf in a web page or browser, Flash Remoting uses
http://apps.mycompany.com:8500/flashservices/gateway as the gateway URL.

Authenticating a user to the application server

In some cases, your application server might require you to provide user authentication—a user
name and password—before you can use a service.
Flash Remoting provides the
specify authentication credentials to send to the application server. Flash Remoting sends the
credentials in the header of every service function call. This method is currently supported on the
following servers:
ColdFusion MX
JRun 4
If you created the gateway object using the NetServices class, you can call the
method to provide authentication, as follows:
import mx.remoting.NetServices;
// set the default gateway URL
NetServices.setDefaultGatewayUrl("http://www.mySite.com/flashservices/
gateway");
// connect to the gateway
gatewayConnection = NetServices.createGatewayConnection();
// authenticate the user
gatewayConnection.setCredentials(username, password)
// create a service object for myService
serviceObject = gatewayConnection.getService("myService", this);
Note: To ensure security, never include specific user names or passwords in ActionScript.
Flash supplies the login credentials with each service request; therefore, your ActionScript should
log the user out of the application server and reset the credentials when the user logs out of your
Flash application.
To log out the user and reset the credentials:
Call a logout service method on the server that logs out the user.
1.
For example, for ColdFusion, call a method that uses the
Set the gateway connection credential information to empty strings.
2.
as the host in the
localhost
setDefaultGatewayUrl()
method and start your Flash application by using the URL http://
setCredentials()
Creating a gateway connection using the NetServices object
setDefaultGatewayUrl()
method with the host and port specified to run
method of the Connection class to allow you to
cflogout
method, and you run your
localhost
setCredentials()
tag.
165

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash remoting mx

Table of Contents