Catching Security Exceptions - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

268
IsAuthorized returns TRUE if the user is authorized to perform the specified action on
the specified ColdFusion resource. IsAuthorized takes three parameters:
IsAuthorized(ResourceType, ResourceName, [ResourceAction])
For example, to check whether the authenticated user is authorized to update a data
source resource called orders, use this syntax:
IsAuthorized("Datasource", "orders", "update")
In this example, the IsAuthorized function returns TRUE if the user is authorized for
the named Datasource, or if the Datasource is not protected in the security context.
Note

Catching Security Exceptions

You can use the structured exception handling tags, CFTRY and CFCATCH, to catch
security exceptions. Setting the TYPE attribute in CFCATCH to "Security" enables you
to catch failures in the CFAUTHENTICATE tag. You can also catch catastrophic failures
from the IsAuthorized or IsAuthenticated functions.
Set the THROWONFAILURE attribute to Yes and enclose the CFAUTHENTICATE tag in
a CFTRY/CFCATCH block if you want to handle possible exceptions programmatically.
For information on exception handling strategies in ColdFusion, see
handling strategies" on page 100
Example
<!--- This exaple shows the use of excpetion handling
with CFAUTHENTICATE in an Application.cfm file --->
<HTML>
<HEAD>
<TITLE>CFAUTHENTICATE Example</TITLE>
</HEAD>
<BODY>
<H3>CFAUTHENTICATE Example></H3>
<P>The CFAUTHENTICATE tag authenticates a user and
sets the security context for an application.
<P>Code this tag in the Application.cfm file to set a
security context for your application.
<P>If the user has not already been defined in the
system, you can either reject the page, request that
the user respecify the username and password, or define
The ColdFusion server does not check user authorization unless a
developer specifically requests it with the IsAuthorized function. It is up
to the developer to decide what action to take based on the results of the
IsAuthorized call.
Developing Web Applications with ColdFusion
"Exception

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 4.5

Table of Contents