Package org.apache.catalina.security
Class SecurityUtil
- java.lang.Object
- 
- org.apache.catalina.security.SecurityUtil
 
- 
 public final class SecurityUtil extends java.lang.ObjectThis utility class associates aSubjectto the currentAccessControlContext. When aSecurityManageris 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 Constructor Description SecurityUtil()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddoAsPrivilege(java.lang.String methodName, Filter targetObject)Perform work as a particularSubject.static voiddoAsPrivilege(java.lang.String methodName, Filter targetObject, java.lang.Class<?>[] targetType, java.lang.Object[] targetArguments)Perform work as a particularSubject.static voiddoAsPrivilege(java.lang.String methodName, Filter targetObject, java.lang.Class<?>[] targetParameterTypes, java.lang.Object[] targetParameterValues, java.security.Principal principal)Perform work as a particularSubject.static voiddoAsPrivilege(java.lang.String methodName, Servlet targetObject)Perform work as a particularSubject.static voiddoAsPrivilege(java.lang.String methodName, Servlet targetObject, java.lang.Class<?>[] targetType, java.lang.Object[] targetArguments)Perform work as a particularSubject.static voiddoAsPrivilege(java.lang.String methodName, Servlet targetObject, java.lang.Class<?>[] targetParameterTypes, java.lang.Object[] targetArguments, java.security.Principal principal)Perform work as a particularSubject.static booleanisPackageProtectionEnabled()Return theSecurityManageronly if Security is enabled AND package protection mechanism is enabled.static voidremove(java.lang.Object cachedObject)Remove the object from the cache.
 
- 
- 
- 
Method Detail- 
doAsPrivilegepublic static void doAsPrivilege(java.lang.String methodName, Servlet targetObject) throws java.lang.ExceptionPerform 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:
- java.lang.Exception- an execution error occurred
 
 - 
doAsPrivilegepublic static void doAsPrivilege(java.lang.String methodName, Servlet targetObject, java.lang.Class<?>[] targetType, java.lang.Object[] targetArguments) throws java.lang.ExceptionPerform 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:
- java.lang.Exception- an execution error occurred
 
 - 
doAsPrivilegepublic static void doAsPrivilege(java.lang.String methodName, Servlet targetObject, java.lang.Class<?>[] targetParameterTypes, java.lang.Object[] targetArguments, java.security.Principal principal) throws java.lang.ExceptionPerform 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:
- java.lang.Exception- an execution error occurred
 
 - 
doAsPrivilegepublic static void doAsPrivilege(java.lang.String methodName, Filter targetObject) throws java.lang.ExceptionPerform 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:
- java.lang.Exception- an execution error occurred
 
 - 
doAsPrivilegepublic static void doAsPrivilege(java.lang.String methodName, Filter targetObject, java.lang.Class<?>[] targetType, java.lang.Object[] targetArguments) throws java.lang.ExceptionPerform 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:
- java.lang.Exception- an execution error occurred
 
 - 
doAsPrivilegepublic static void doAsPrivilege(java.lang.String methodName, Filter targetObject, java.lang.Class<?>[] targetParameterTypes, java.lang.Object[] targetParameterValues, java.security.Principal principal) throws java.lang.ExceptionPerform 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:
- java.lang.Exception- an execution error occurred
 
 - 
removepublic static void remove(java.lang.Object cachedObject) Remove 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
 
 
- 
 
-