ColdFusion 9.0 Resources |
Authenticating usersUse either, or both, of the following forms of authentication to secure your ColdFusion application:
Web server authenticationAll major web servers support basic HTTP authentication. Some web servers also support other authentication methods, including Digest HTTP authentication and Microsoft NTLM authentication. Note: Dreamweaver and Studio MX do not support
NTLM security with RDS. Therefore, you cannot use RDS with these
applications if the ColdFusion RDS servlet (cf_root/CFIDE/main/ide.cfm)
is in a directory that is protected using NTLM security.
In web server authentication, the web server requires the user to log in to access pages in a particular directory, as follows:
You can use web server authentication without using any ColdFusion security features. In this case, you configure and manage all user security through the web server’s interfaces. You can also use web server authentication with ColdFusion application authentication, and thus use ColdFusion security for authorization. If the web server uses basic HTML authentication, the ColdFusion cflogin tag provides access to the user ID and password that the user entered to log in to the web server. If the web server uses Digest or NTLM authentication, the cflogin tag normally gets the user ID, but not the password. As a result, your application rely on the web server to authenticate the user against its user and password information, and does not have to display a login page. You use the cflogin and cfloginuser tags to log the user into the ColdFusion user security system, and use the IsUserInAnyRole and GetAuthUser functions to ensure user authorization. For more information on this form of security, see A web server authentication security scenario. Note: If a user has logged in using web server authentication
and has not logged in using ColdFusion application authentication,
the GetAuthUser tag returns the web server user
ID. You could use this feature to combine web server authentication with
application authorization based on the user’s ID.
Application authenticationWith application authentication, you do not rely on the web server to enforce application security. The application performs all user authentication and authorization. The application displays a login page, checks the user’s identity and login against its own authorization store, such as an LDAP directory or database, and logs the user into ColdFusion using the cfloginuser tag. The application then uses the IsUserInAnyRole and GetAuthUser functions to check the user’s roles or identity for authorization before running a ColdFusion page or specific code on a page. For an example of application authentication use, see An application authentication security scenario. ColdFusion authentication storage and persistenceHow ColdFusion application authentication information is maintained by the browser and ColdFusion, and therefore how long it is available, depends on the following:
Note: For detailed information on Session scope, see Configuring and using session variables. Cookie scope contains the cookies
that arthe browser sends; for more information on using cookies,
see cfcookie in the CFML Reference.
Authentication and cookiesBecause HTTP is connectionless, a login can last beyond a single web page viewing only if the browser provides a unique identifier that software on the server uses to confirm that the current user is authenticated. Normally, this is done by using memory-only cookies that are automatically destroyed when the user closes all open browser windows. The specific cookies and how they are used depend on whether the application supports the Session scope for login storage. Note: For information on user logins without cookies,
see Using ColdFusion security without cookies.
Using the Session scopeIf you do the following, ColdFusion maintains login information in the Session scope instead of the Cookie scope:
If you do not enable the Session scope, the authentication information is not kept in a persistent scope. Instead, the detailed login information is placed in a memory-only cookie (CFAUTHORIZATION_applicationName) with a base64-encoded string that contains the user name, password, and application name. The client sends this cookie to the web server each time it makes a page request while the user is logged-in. Use SSL for all page transactions to protect the user ID and password from unauthorized access. Using ColdFusion security without cookiesImplement a limited-lifetime form of ColdFusion security if the user’s browser does not support cookies. In this case you do not use the cflogin tag, only the cfloginuser tag. It is the only time you should use the cfloginuser tag outside a cflogin tag. Without browser cookies, the effect of the cfloginuser tag is limited to a single HTTP request. Provide your own authentication mechanism and call cfloginuser on each page on which you use ColdFusion login identification. |