User Guide

Table Of Contents
Using ColdFusion security tags and functions 385
Note: You must ensure that your web server is configured correctly to support browser-based login
forms for this use. For example, in IIS 5, you must enable anonymous access and might have to
disable Basic authentication and Integrated Windows authentication.
The following cflogin tag tells the browser to display a login form if the user has not logged in:
<cflogin>
<cfif NOT IsDefined("cflogin")>
<cfheader statuscode="401">
<cfheader name="www-Authenticate" value="Basic
realm=""MM Wizard #args.authtype# Authentication""">
</cfif>
<cfabort>
<cfelse>
<!--- code to authenticate the user based on the cflogin.user and
cflogin.password values goes here. --->
</cflogin>
Logging in a user using Flash Remoting
If you are developing a Rich Internet Application with Macromedia Flash and Flash Remoting,
your ColdFusion application does not need to be coded specially for a Flash login. The Flash
Remoting gateway makes the user ID and password available to the
cflogin tag in the cflogin
structure.
In your Flash code, you use the ActionScript
SetCredentials method to send login information
to ColdFusion. Your Flash SWF file displays the user ID and password fields, and uses their
contents in the
setCredentials method, as follows:
if (inited == null)
{
inited = true;
NetServices.setDefaultGatewayUrl("http://localhost/flashservices/gateway");
gatewayConnection = NetServices.createGatewayConnection();
gatewayConnection.setCredentials(userID, password);
myService = gatewayConnection.getService("securityTest.thecfc", this);
}
For more information on using Flash Remoting, see Using Flash Remoting MX.
Logging out users
After a user logs in, the ColdFusion user authorization and authentication information remains
valid until any of the following happens:
The application uses a cflogout tag to log out the user, usually in response to the user clicking
a log-out link or button.
If your application uses the Session scope for login information, the session ends.
If your application does not use the Session scope for login information, the user does not
request a new page for the
cflogin tag idleTimeout period.
If your application does not use Session scope for login information, or if you use J2EE-based
session identification, the user closes all browser windows.