public final class SecurityUtil
extends java.lang.Object
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 and Description | 
|---|
| SecurityUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| static void | doAsPrivilege(java.lang.String methodName,
Filter targetObject)Perform work as a particular Subject. | 
| static void | doAsPrivilege(java.lang.String methodName,
Filter targetObject,
java.lang.Class<?>[] targetType,
java.lang.Object[] targetArguments)Perform work as a particular  Subject. | 
| static void | doAsPrivilege(java.lang.String methodName,
Filter targetObject,
java.lang.Class<?>[] targetParameterTypes,
java.lang.Object[] targetParameterValues,
java.security.Principal principal)Perform work as a particular  Subject. | 
| static void | doAsPrivilege(java.lang.String methodName,
Servlet targetObject)Perform work as a particular Subject. | 
| static void | doAsPrivilege(java.lang.String methodName,
Servlet targetObject,
java.lang.Class<?>[] targetType,
java.lang.Object[] targetArguments)Perform work as a particular Subject. | 
| static void | doAsPrivilege(java.lang.String methodName,
Servlet targetObject,
java.lang.Class<?>[] targetParameterTypes,
java.lang.Object[] targetArguments,
java.security.Principal principal)Perform work as a particular Subject. | 
| static boolean | isPackageProtectionEnabled()Return the  SecurityManageronly if Security is enabled AND
package protection mechanism is enabled. | 
| static void | remove(java.lang.Object cachedObject)Remove the object from the cache. | 
public static void doAsPrivilege(java.lang.String methodName,
                 Servlet targetObject)
                          throws java.lang.Exception
null subject.methodName - the method to apply the security restrictiontargetObject - the Servlet on which the method will
be called.java.lang.Exceptionpublic static void doAsPrivilege(java.lang.String methodName,
                 Servlet targetObject,
                 java.lang.Class<?>[] targetType,
                 java.lang.Object[] targetArguments)
                          throws java.lang.Exception
null subject.methodName - the method to apply the security restrictiontargetObject - the Servlet on which the method will
be called.targetType - Class array used to instantiate a
Method object.targetArguments - Object array contains the runtime
parameters instance.java.lang.Exceptionpublic static void doAsPrivilege(java.lang.String methodName,
                 Servlet targetObject,
                 java.lang.Class<?>[] targetParameterTypes,
                 java.lang.Object[] targetArguments,
                 java.security.Principal principal)
                          throws java.lang.Exception
null subject.methodName - the method to apply the security restrictiontargetObject - the Servlet on which the method will
be called.targetParameterTypes - Class array used to instantiate a
Method object.targetArguments - Object array contains the
runtime parameters instance.principal - the Principal to which the security
privilege apply..java.lang.Exceptionpublic static void doAsPrivilege(java.lang.String methodName,
                 Filter targetObject)
                          throws java.lang.Exception
null subject.methodName - the method to apply the security restrictiontargetObject - the Filter on which the method will
be called.java.lang.Exceptionpublic static void doAsPrivilege(java.lang.String methodName,
                 Filter targetObject,
                 java.lang.Class<?>[] targetType,
                 java.lang.Object[] targetArguments)
                          throws java.lang.Exception
Subject. Here the work
will be granted to a null subject.methodName - the method to apply the security restrictiontargetObject - the Filter on which the method will
be called.targetType - Class array used to instantiate a
Method object.targetArguments - Object array contains the
runtime parameters instance.java.lang.Exceptionpublic static void doAsPrivilege(java.lang.String methodName,
                 Filter targetObject,
                 java.lang.Class<?>[] targetParameterTypes,
                 java.lang.Object[] targetParameterValues,
                 java.security.Principal principal)
                          throws java.lang.Exception
Subject. Here the work
will be granted to a null subject.methodName - the method to apply the security restrictiontargetObject - the Filter on which the method will
be called.targetParameterTypes - Class array used to instantiate a
Method object.targetParameterValues - Object array contains the
runtime parameters instance.principal - the Principal to which the security
privilege applyjava.lang.Exceptionpublic static void remove(java.lang.Object cachedObject)
cachedObject - The object to removepublic static boolean isPackageProtectionEnabled()
SecurityManager only if Security is enabled AND
package protection mechanism is enabled.Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.