IsAuthenticated

Description

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.

Category

Decision functions

Syntax


IsAuthenticated([security-context-name ]) 

See also

cfauthenticate, AuthenticatedContext, AuthenticatedUser, IsAuthorized

Parameters

Parameter
Description
security-context-name
Security context name

Usage

Before using IsAuthorized, ensure that advanced security is enabled in the ColdFusion Administrator, and define the security contexts.

Example

<!--- 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> 



Banner.Novgorod.Ru