Package org.apache.catalina.security
Class SecurityUtil
java.lang.Object
org.apache.catalina.security.SecurityUtil
This utility class associates a 
Subject to the current AccessControlContext. When a
 SecurityManager is used, the container will always associate the called thread with an
 AccessControlContext containing only the principal of the requested Servlet/Filter. This class uses reflection to
 invoke the methods.- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voiddoAsPrivilege(String methodName, Filter targetObject) Perform work as a particularSubject.static voiddoAsPrivilege(String methodName, Filter targetObject, Class<?>[] targetType, Object[] targetArguments) Perform work as a particularSubject.static voiddoAsPrivilege(String methodName, Filter targetObject, Class<?>[] targetParameterTypes, Object[] targetParameterValues, Principal principal) Perform work as a particularSubject.static voiddoAsPrivilege(String methodName, Servlet targetObject) Perform work as a particularSubject.static voiddoAsPrivilege(String methodName, Servlet targetObject, Class<?>[] targetType, Object[] targetArguments) Perform work as a particularSubject.static voiddoAsPrivilege(String methodName, Servlet targetObject, Class<?>[] targetParameterTypes, Object[] targetArguments, Principal principal) Perform work as a particularSubject.static booleanReturn theSecurityManageronly if Security is enabled AND package protection mechanism is enabled.static voidRemove the object from the cache.
- 
Constructor Details- 
SecurityUtilpublic SecurityUtil()
 
- 
- 
Method Details- 
doAsPrivilegePerform work as a particularSubject. Here the work will be granted to anullsubject.- Parameters:
- methodName- the method to apply the security restriction
- targetObject- the- Servleton which the method will be called.
- Throws:
- Exception- an execution error occurred
 
- 
doAsPrivilegepublic static void doAsPrivilege(String methodName, Servlet targetObject, Class<?>[] targetType, Object[] targetArguments) throws Exception Perform work as a particularSubject. Here the work will be granted to anullsubject.- Parameters:
- methodName- the method to apply the security restriction
- targetObject- the- Servleton which the method will be called.
- targetType-- Classarray used to instantiate a- Methodobject.
- targetArguments-- Objectarray contains the runtime parameters instance.
- Throws:
- Exception- an execution error occurred
 
- 
doAsPrivilegepublic static void doAsPrivilege(String methodName, Servlet targetObject, Class<?>[] targetParameterTypes, Object[] targetArguments, Principal principal) throws Exception Perform work as a particularSubject. Here the work will be granted to anullsubject.- Parameters:
- methodName- the method to apply the security restriction
- targetObject- the- Servleton which the method will be called.
- targetParameterTypes-- Classarray used to instantiate a- Methodobject.
- targetArguments-- Objectarray contains the runtime parameters instance.
- principal- the- Principalto which the security privilege applies
- Throws:
- Exception- an execution error occurred
 
- 
doAsPrivilegePerform work as a particularSubject. Here the work will be granted to anullsubject.- Parameters:
- methodName- the method to apply the security restriction
- targetObject- the- Filteron which the method will be called.
- Throws:
- Exception- an execution error occurred
 
- 
doAsPrivilegepublic static void doAsPrivilege(String methodName, Filter targetObject, Class<?>[] targetType, Object[] targetArguments) throws Exception Perform work as a particularSubject. Here the work will be granted to anullsubject.- Parameters:
- methodName- the method to apply the security restriction
- targetObject- the- Filteron which the method will be called.
- targetType-- Classarray used to instantiate a- Methodobject.
- targetArguments-- Objectarray contains the runtime parameters instance.
- Throws:
- Exception- an execution error occurred
 
- 
doAsPrivilegepublic static void doAsPrivilege(String methodName, Filter targetObject, Class<?>[] targetParameterTypes, Object[] targetParameterValues, Principal principal) throws Exception Perform work as a particularSubject. Here the work will be granted to anullsubject.- Parameters:
- methodName- the method to apply the security restriction
- targetObject- the- Filteron which the method will be called.
- targetParameterTypes-- Classarray used to instantiate a- Methodobject.
- targetParameterValues-- Objectarray contains the runtime parameters instance.
- principal- the- Principalto which the security privilege applies
- Throws:
- Exception- an execution error occurred
 
- 
removeRemove the object from the cache.- Parameters:
- cachedObject- The object to remove
 
- 
isPackageProtectionEnabledpublic static boolean isPackageProtectionEnabled()Return theSecurityManageronly if Security is enabled AND package protection mechanism is enabled.- Returns:
- trueif package level protection is enabled
 
 
-