Associates a given
SecurityContext with the current execution thread. This class provides a series of
static methods that delegate to an instance of
org.acegisecurity.context.SecurityContextHolderStrategy . The
purpose of the class is to provide a convenient way to specify the strategy that should be used for a given JVM.
This is a JVM-wide setting, since everything in this class is static to facilitate ease of use in
calling code.
To specify which strategy should be used, you must provide a mode setting. A mode setting is one of the
three valid MODE_ settings defined as static final fields, or a fully qualified classname
to a concrete implementation of
org.acegisecurity.context.SecurityContextHolderStrategy that provides a
public no-argument constructor.
There are two ways to specify the desired strategy mode String . The first is to specify it via
the system property keyed on
SecurityContextHolder.SYSTEM_PROPERTY . The second is to call
SecurityContextHolder.setStrategyName(String) before using the class. If neither approach is used, the class will default to using
SecurityContextHolder.MODE_THREADLOCAL ,
which is backwards compatible, has fewer JVM incompatibilities and is appropriate on servers (whereas
SecurityContextHolder.MODE_GLOBAL is definitely inappropriate for server use).
author: Ben Alex version: $Id: SecurityContextHolder.java 1535 2006-06-01 14:02:56Z benalex $ See Also: org.acegisecurity.context.HttpSessionContextIntegrationFilter |