# IsAuthenticated

Returns TRUE if the user has been authenticated for any ColdFusion security context. If you specify the name of the security context, IsAuthenticated returns TRUE if the user has been authenticated for the specified ColdFusion security context.

See also CFAUTHENTICATE, AuthenticatedContext, AuthenticatedUser, and IsAuthorized.

### Syntax

    IsAuthenticated([security-context-name ])

##### security-context-name

The security context name.

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