public final class SecurityUtil extends 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 invoke methods.Modifier and Type | Field and Description |
---|---|
static boolean |
executeUnderSubjectDoAs
Do we need to execute all invokation under a Subject.doAs call.
|
Constructor and Description |
---|
SecurityUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
doAsPrivilege(String methodName,
javax.servlet.Filter targetObject)
Perform work as a particular
Subject . |
static void |
doAsPrivilege(String methodName,
javax.servlet.Filter targetObject,
Class[] targetType,
Object[] targetArguments,
Principal principal)
Perform work as a particular
Subject . |
static void |
doAsPrivilege(String methodName,
javax.servlet.Filter targetObject,
Class<?>[] targetType,
Object[] targetArguments)
Perform work as a particular
Subject . |
static void |
doAsPrivilege(String methodName,
javax.servlet.Servlet targetObject)
Perform work as a particular
Subject . |
static void |
doAsPrivilege(String methodName,
javax.servlet.Servlet targetObject,
Class<?>[] targetType,
Object[] targetArguments)
Perform work as a particular
Subject . |
static void |
doAsPrivilege(String methodName,
javax.servlet.Servlet targetObject,
Class<?>[] targetType,
Object[] targetArguments,
Principal principal)
Perform work as a particular
Subject . |
static boolean |
executeUnderSubjectDoAs()
Return true if a
SecurityManager is used and is
isDoAsRequired is required. |
static boolean |
isPackageProtectionEnabled()
Return the
SecurityManager only if Security is enabled AND
package protection mechanism is enabled. |
static void |
remove(Object cachedObject)
Remove the object from the cache.
|
public static final boolean executeUnderSubjectDoAs
public static void doAsPrivilege(String methodName, javax.servlet.Servlet targetObject) throws Exception
Subject
. Here the work
will be granted to a null
subject.methodName
- the method to apply the security restrictiontargetObject
- the Servlet
on which the method will
be called.Exception
public static void doAsPrivilege(String methodName, javax.servlet.Servlet targetObject, Class<?>[] targetType, Object[] targetArguments) throws Exception
Subject
. Here the work
will be granted to a 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 i
Method
object.targetObject
- Object
array contains the runtime
parameters instance.Exception
public static void doAsPrivilege(String methodName, javax.servlet.Servlet targetObject, Class<?>[] targetType, Object[] targetArguments, Principal principal) throws Exception
Subject
. Here the work
will be granted to a 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.principal
- the Principal
to which the security
privilege apply..Exception
public static void doAsPrivilege(String methodName, javax.servlet.Filter targetObject) throws 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.Exception
public static void doAsPrivilege(String methodName, javax.servlet.Filter targetObject, Class<?>[] targetType, Object[] targetArguments) throws 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.Exception
public static void doAsPrivilege(String methodName, javax.servlet.Filter targetObject, Class[] targetType, Object[] targetArguments, Principal principal) throws 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.principal
- the Principal
to which the security
privilege applyException
public static void remove(Object cachedObject)
public static boolean isPackageProtectionEnabled()
SecurityManager
only if Security is enabled AND
package protection mechanism is enabled.public static boolean executeUnderSubjectDoAs()
SecurityManager
is used and is
isDoAsRequired
is required.Copyright © 2019. All rights reserved.