public final class AccessController extends Object
Modifier and Type | Method and Description |
---|---|
static void |
checkPermission(Permission perm)
Checks whether the running program is allowed to
access the resource being guarded by the given
Permission argument.
|
static <T> T |
doPrivileged(PrivilegedAction<T> action)
Performs the privileged action specified by
action . |
static <T> T |
doPrivileged(PrivilegedAction<T> action,
AccessControlContext context)
Performs the privileged action specified by
action . |
static <T> T |
doPrivileged(PrivilegedAction<T> action,
AccessControlContext context,
Permission... perms)
Performs the privileged action specified by
action . |
static <T> T |
doPrivileged(PrivilegedExceptionAction<T> action)
Performs the privileged action specified by
action . |
static <T> T |
doPrivileged(PrivilegedExceptionAction<T> action,
AccessControlContext context)
Performs the privileged action specified by
action . |
static <T> T |
doPrivileged(PrivilegedExceptionAction<T> action,
AccessControlContext context,
Permission... perms)
Performs the privileged action specified by
action . |
static <T> T |
doPrivilegedWithCombiner(PrivilegedAction<T> action)
Performs the privileged action specified by
action , retaining
any current DomainCombiner. |
static <T> T |
doPrivilegedWithCombiner(PrivilegedAction<T> action,
AccessControlContext context,
Permission... perms)
Performs the privileged action specified by
action , retaining
any current DomainCombiner. |
static <T> T |
doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action)
Performs the privileged action specified by
action , retaining
any current DomainCombiner. |
static <T> T |
doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action,
AccessControlContext context,
Permission... perms)
Performs the privileged action specified by
action , retaining
any current DomainCombiner. |
static AccessControlContext |
getContext()
Answers the access controller context of the current thread,
including the inherited ones.
|
public static void checkPermission(Permission perm) throws AccessControlException
perm
- the permission to checkAccessControlException
- if access is not allowed.
NullPointerException if perm is nullpublic static AccessControlContext getContext()
AccessControlContext
with them.AccessControlContext
public static <T> T doPrivileged(PrivilegedAction<T> action)
action
.
When permission checks are made, if the permission has been granted by all frames below and including the one representing the call to this method, then the permission is granted. In other words, the check stops here. Any unchecked exception generated by this method will propagate up the chain.
T
- the type of value returned by PrivilegedAction.runaction
- The PrivilegedAction to performedNullPointerException
- if action is nulldoPrivileged(PrivilegedAction)
public static <T> T doPrivileged(PrivilegedAction<T> action, AccessControlContext context)
action
.
When permission checks are made, if the permission has been granted by all
frames below and including the one representing the call to this method,
then the permission is granted iff it is granted by the AccessControlContext
context
. In other words, no more checking of the current stack
is performed. Instead, the passed in context is checked.
Any unchecked exception generated by this method will propagate up the chain.
T
- the type of value returned by PrivilegedAction.runaction
- The PrivilegedAction to performedcontext
- The AccessControlContext to checkNullPointerException
- if action is nulldoPrivileged(PrivilegedAction)
public static <T> T doPrivileged(PrivilegedExceptionAction<T> action) throws PrivilegedActionException
action
.
When permission checks are made, if the permission has been granted by all frames below and including the one representing the call to this method, then the permission is granted. In other words, the check stops here. Any unchecked exception generated by this method will propagate up the chain. However, checked exceptions will be caught an re-thrown as PrivilegedActionExceptions
T
- the type of value returned by PrivilegedExceptionAction.runaction
- The PrivilegedExceptionAction to performedPrivilegedActionException
- when a checked exception occurs when performing the action
NullPointerException if action is nulldoPrivileged(PrivilegedAction)
public static <T> T doPrivileged(PrivilegedExceptionAction<T> action, AccessControlContext context) throws PrivilegedActionException
action
.
When permission checks are made, if the permission has been granted by all
frames below and including the one representing the call to this method,
then the permission is granted iff it is granted by the AccessControlContext
context
. In other words, no more checking of the current stack
is performed. Instead, the passed in context is checked.
Any unchecked exception generated by this method will propagate up the chain.
However, checked exceptions will be caught an re-thrown as PrivilegedActionExceptions
T
- the type of value returned by PrivilegedExceptionAction.runaction
- The PrivilegedExceptionAction to performedcontext
- The AccessControlContext to checkPrivilegedActionException
- when a checked exception occurs when performing the action
NullPointerException if action is nulldoPrivileged(PrivilegedAction)
public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action)
action
, retaining
any current DomainCombiner.
When permission checks are made, if the permission has been granted by all frames below and including the one representing the call to this method, then the permission is granted. In other words, the check stops here. Any unchecked exception generated by this method will propagate up the chain.
T
- the type of value returned by PrivilegedAction.runaction
- The PrivilegedAction to performeddoPrivileged(PrivilegedAction)
public static <T> T doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action) throws PrivilegedActionException
action
, retaining
any current DomainCombiner.
When permission checks are made, if the permission has been granted by all frames below and including the one representing the call to this method, then the permission is granted. In other words, the check stops here. Any unchecked exception generated by this method will propagate up the chain. However, checked exceptions will be caught an re-thrown as PrivilegedActionExceptions
T
- the type of value returned by PrivilegedExceptionAction.runaction
- The PrivilegedExceptionAction to performedPrivilegedActionException
- when a checked exception occurs when performing the actiondoPrivileged(PrivilegedAction)
public static <T> T doPrivileged(PrivilegedAction<T> action, AccessControlContext context, Permission... perms)
action
.
When permission checks are made, if the permission has been granted by all
frames below and including the one representing the call to this method,
then the permission is granted iff it is granted by the AccessControlContext
context
and also granted by one of the permissions arguments.
Any unchecked exception generated by this method will propagate up the chain.
T
- the type of value returned by PrivilegedAction.runaction
- The PrivilegedAction to performedcontext
- The AccessControlContext to checkperms
- The Permission arguments to limit the scope of the caller's privileges.NullPointerException
- if action is nulldoPrivileged(PrivilegedAction)
,
doPrivileged(PrivilegedAction, AccessControlContext)
public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action, AccessControlContext context, Permission... perms)
action
, retaining
any current DomainCombiner.
When permission checks are made, if the permission has been granted by all frames below and including the one representing the call to this method, then the permission is granted iff it is granted by one of the permissions arguments. Any unchecked exception generated by this method will propagate up the chain.
T
- the type of value returned by PrivilegedAction.runaction
- The PrivilegedAction to performedcontext
- The AccessControlContext to checkperms
- The Permission arguments to limit the scope of the caller's privileges.doPrivileged(PrivilegedAction)
,
doPrivileged(PrivilegedAction, AccessControlContext)
public static <T> T doPrivileged(PrivilegedExceptionAction<T> action, AccessControlContext context, Permission... perms) throws PrivilegedActionException
action
.
When permission checks are made, if the permission has been granted by all
frames below and including the one representing the call to this method,
then the permission is granted iff it is granted by the AccessControlContext
context
and also granted by one of the permissions arguments.
Any unchecked exception generated by this method will propagate up the chain.
However, checked exceptions will be caught an re-thrown as PrivilegedActionExceptions
T
- the type of value returned by PrivilegedExceptionAction.runaction
- The PrivilegedExceptionAction to performedcontext
- The AccessControlContext to checkperms
- The Permission arguments to limit the scope of the caller's privileges.PrivilegedActionException
- when a checked exception occurs when performing the action
NullPointerException if action is nulldoPrivileged(PrivilegedAction)
,
doPrivileged(PrivilegedAction, AccessControlContext)
public static <T> T doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action, AccessControlContext context, Permission... perms) throws PrivilegedActionException
action
, retaining
any current DomainCombiner.
When permission checks are made, if the permission has been granted by all frames below and including the one representing the call to this method, then the permission is granted and also granted by one of the permissions arguments. Any unchecked exception generated by this method will propagate up the chain. However, checked exceptions will be caught an re-thrown as PrivilegedActionExceptions
T
- the type of value returned by PrivilegedExceptionAction.runaction
- The PrivilegedExceptionAction to performedcontext
- The AccessControlContext to checkperms
- The Permission arguments to limit the scope of the caller's privileges.PrivilegedActionException
- when a checked exception occurs when performing the actiondoPrivileged(PrivilegedAction)
,
doPrivileged(PrivilegedAction, AccessControlContext)
Eclipse OpenJ9 website.
To raise a bug report or suggest an improvement create an Eclipse OpenJ9 issue.
Copyright © 1993, 2023 IBM Corp. and others.