Returns TRUE if the user is authenticated for a ColdFusion security context. If you specify a security context name, IsAuthenticated returns TRUE if the user is authenticated for it. See the Usage section for crucial information.
IsAuthenticated([security-context-name ])
cfauthenticate, AuthenticatedContext, AuthenticatedUser, IsAuthorized
| Parameter |
Description |
|---|---|
| security-context-name |
Security context name |
Before using IsAuthorized, ensure that advanced security is enabled in the ColdFusion Administrator, and define the security contexts.
<!--- This example calls the IsAuthenticated function. --->
<!--- This code is from an Application.cfm file --->
<cfif NOT IsAuthenticated("Allaire")>
<CFTRY>
<CFAUTHENTICATE SECURITYCONTEXT = "Allaire" USERname = #user#
PASSWORD = #pwd#>
<CFCATCH type = "Security">
<!--- the message to display --->
<H3>Authentication error</H3>
<cfoutput>
<!--- Display the message. Alternatively, you might place
code here to define the user to the security context. --->
<P>#CFCATCH.message#
</cfoutput>
</CFCATCH>
</CFTRY>
</cfif>
<CFAPPLICATION name = "Personnel">
</body>
</html>