User Guide

Table Of Contents
382 Chapter 16: Securing Applications
Using the cflogin tag
The
cflogin tag executes only if there is no currently logged-in user. It has the following three
optional arguments that control the characteristics of a ColdFusion login:
Login identification scope and the applicationToken attribute
The login identification created by the
cflogin tag is valid only for pages within the directory
that contains the page that uses the
cflogin tag and any of its subdirectories. Therefore, if a user
requests a page in another directory tree, the current login credentials are not valid for accessing
those pages. This security limitation lets you use the same user names and passwords for different
sections of your application (for example, a UserFunctions tree and a SecurityFunctions tree) and
enforce different roles to the users depending on the section.
ColdFusion uses the
applicationToken value to generate a unique identifier that enforces this
rule. The default
applicationToken value is the current application name, as specified by a
cfapplication tag or Application.cfc unitization code. In normal use, you do not need to
specify an
applicationToken value in the cflogin tag.
cflogout Logs out the current user. Removes knowledge of the user ID and roles from
the server. If you do not use this tag, the user is automatically logged out as
described in “Logging out users” on page 385.
The
cflogout tag does not take any attributes, and does not have a body.
cfNTauthenticate Authenticates a user name and password against the NT domain on which
ColdFusion server is running, and optionally retrieves the user’s groups.
cffunction If you include a roles attribute, the function executes only when there is a
logged-in user who belongs to one of the specified roles.
IsUserInRole Returns True if the current user is a member of the specified role.
GetAuthUser Returns the ID of the currently logged-in user.
This tag first checks for a login made with
cfloginuser tag. If none exists, it
checks for a web server login (cgi.remote_user.
Attribute Use
idleTimeout If no page requests occur during the idleTimeout period, ColdFusion logs out
the user. The default is 1800 seconds (30 minutes). This is ignored if login
information is stored in the Session scope.
applicationToken Limits the login validity to a specific application as specified by a ColdFusion
page’s
cfapplication tag. The default value is the current application name.
cookieDomain Specifies the domain of the cookie used to mark a user as logged-in. You use
cookieDomain if you have a clustered environment (for example, x.acme.com,
x2.acme.com, and so on). This lets the cookie work for all the computers in the
cluster.
Tag or function Purpose