User Guide

Table Of Contents
Using CFCs effectively 235
Code that manipulates persistent scope CFC properties must be locked, just as all other code that
manipulates persistent scope properties must be locked. Therefore, you must lock both of the
following types of application code:
Code that directly manipulates properties of a persistent scope CFC instance
Code that calls methods of a persistent scope CFC instance that manipulate properties of the
instance
If you put multiple CFC instances in a single persistent scope, you can create a named lock for
each CFC instance. For more information on locking, see Chapter 15, “Using Persistent Data and
Locking,” on page 339.
Note: Session scope CFCs cannot be serialized, so you cannot use them with clustered sessions; for
example, if you want to support session failover among servers.
Building secure ColdFusion components
To restrict access to component methods, ColdFusion components use the following security
features:
Access security
Role-based security
Programmatic security
Using access security
CFC access security lets you limit the code that can access the components. You specify the access
to a CFC method by specifying the
cffunction access attribute, as follows:
Using role-based security
If you specify a
roles attribute in a cffunction tag, only users who are logged in with one of the
specified roles can execute the method. When a user tries to invoke a method that he or she is not
authorized to invoke, an exception is returned.
Type Description
private Available only to the component that declares the method and any components that
extend the component in which it is defined. This usage is similar to the Java
protected keyword, not the Java private keyword.
package Available only to the component that declares the method, components that extend
the component, or any other components in the package. A package consists of all
components defined in a single directory. For more information on packages, see
“Using component packages” on page 233.
public Available to any locally executing ColdFusion page or component method.
remote Available to a locally or remotely executing ColdFusion page or component method,
or to a local or remote client through a URL, form submission, Flash Remoting MX, or
as a web service.