@Deprecated(since="17", forRemoval=true) public final class AccessController extends Object
AccessController was used with the Security Manager for access control operations and decisions. This feature no longer exists.| Modifier and Type | Method | Description |
|---|---|---|
static void |
checkPermission |
Deprecated, for removal: This API element is subject to removal in a future version. Throws AccessControlException. |
static <T> T |
doPrivileged |
Deprecated, for removal: This API element is subject to removal in a future version. Performs the specified action. |
static <T> T |
doPrivileged |
Deprecated, for removal: This API element is subject to removal in a future version. Performs the specified action. |
static <T> T |
doPrivileged |
Deprecated, for removal: This API element is subject to removal in a future version. Performs the specified action. |
static <T> T |
doPrivileged |
Deprecated, for removal: This API element is subject to removal in a future version. Performs the specified action. |
static <T> T |
doPrivileged |
Deprecated, for removal: This API element is subject to removal in a future version. Performs the specified action. |
static <T> T |
doPrivileged |
Deprecated, for removal: This API element is subject to removal in a future version. Performs the specified action. |
static <T> T |
doPrivilegedWithCombiner |
Deprecated, for removal: This API element is subject to removal in a future version. Performs the specified action. |
static <T> T |
doPrivilegedWithCombiner |
Deprecated, for removal: This API element is subject to removal in a future version. Performs the specified action. |
static <T> T |
doPrivilegedWithCombiner |
Deprecated, for removal: This API element is subject to removal in a future version. Performs the specified action. |
static <T> T |
doPrivilegedWithCombiner |
Deprecated, for removal: This API element is subject to removal in a future version. Performs the specified action. |
static AccessControlContext |
getContext() |
Deprecated, for removal: This API element is subject to removal in a future version. Returns an AccessControlContext where the checkPermission method always throws an AccessControlException and the getDomainCombiner method always returns null. |
public static <T> T doPrivileged(PrivilegedAction<T> action)
If the action's run method throws an (unchecked) exception, it will propagate through this method.
PrivilegedAction with privileges enabled. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.T - the type of the value returned by the PrivilegedAction's run methodaction - the action to be performedrun methodNullPointerException - if the action is null
public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action)
If the action's run method throws an (unchecked) exception, it will propagate through this method.
PrivilegedAction with privileges enabled and with the current access control context's domain combiner preserved. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.T - the type of the value returned by the PrivilegedAction's run methodaction - the action to be performedrun methodNullPointerException - if the action is null
public static <T> T doPrivileged(PrivilegedAction<T> action, AccessControlContext context)
If the action's run method throws an (unchecked) exception, it will propagate through this method.
PrivilegedAction with privileges enabled and restricted by the specified AccessControlContext. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.T - the type of the value returned by the PrivilegedAction's run methodaction - the action to be performed.context - ignoredrun methodNullPointerException - if the action is null
public static <T> T doPrivileged(PrivilegedAction<T> action, AccessControlContext context, Permission... perms)
If the action's run method throws an (unchecked) exception, it will propagate through this method.
PrivilegedAction with privileges enabled and restricted by the specified AccessControlContext and with a privilege scope limited by the specified Permission arguments. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.T - the type of the value returned by the PrivilegedAction's run methodaction - the action to be performedcontext - ignoredperms - ignoredrun methodNullPointerException - if action is null
public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action, AccessControlContext context, Permission... perms)
If the action's run method throws an (unchecked) exception, it will propagate through this method.
PrivilegedAction with privileges enabled and restricted by the specified AccessControlContext and with a privilege scope limited by the specified Permission arguments. This method also originally preserved the current access control context's domain combiner while the action was performed. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.T - the type of the value returned by the PrivilegedAction's run methodaction - the action to be performedcontext - ignoredperms - ignoredrun methodNullPointerException - if action is null
public static <T> T doPrivileged(PrivilegedExceptionAction<T> action) throws PrivilegedActionException
If the action's run method throws an unchecked exception, it will propagate through this method.
PrivilegedExceptionAction with privileges enabled. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.T - the type of the value returned by the PrivilegedExceptionAction's run methodaction - the action to be performedrun methodPrivilegedActionException - if the specified action's run method threw a checked exceptionNullPointerException - if the action is null
public static <T> T doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action) throws PrivilegedActionException
If the action's run method throws an unchecked exception, it will propagate through this method.
PrivilegedExceptionAction with privileges enabled and with the current access control context's domain combiner preserved. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.T - the type of the value returned by the PrivilegedExceptionAction's run methodaction - the action to be performedrun methodPrivilegedActionException - if the specified action's run method threw a checked exceptionNullPointerException - if the action is null
public static <T> T doPrivileged(PrivilegedExceptionAction<T> action, AccessControlContext context) throws PrivilegedActionException
If the action's run method throws an unchecked exception, it will propagate through this method.
PrivilegedExceptionAction with privileges enabled and restricted by the specified AccessControlContext. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.T - the type of the value returned by the PrivilegedExceptionAction's run methodaction - the action to be performedcontext - ignoredrun methodPrivilegedActionException - if the specified action's run method threw a checked exceptionNullPointerException - if the action is null
public static <T> T doPrivileged(PrivilegedExceptionAction<T> action, AccessControlContext context, Permission... perms) throws PrivilegedActionException
If the action's run method throws an (unchecked) exception, it will propagate through this method.
PrivilegedExceptionAction with privileges enabled and restricted by the specified AccessControlContext and with a privilege scope limited by the specified Permission arguments. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.T - the type of the value returned by the PrivilegedExceptionAction's run methodaction - the action to be performedcontext - ignoredperms - ignoredrun methodPrivilegedActionException - if the specified action's run method threw a checked exceptionNullPointerException - if action is null
public static <T> T doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action, AccessControlContext context, Permission... perms) throws PrivilegedActionException
If the action's run method throws an (unchecked) exception, it will propagate through this method.
PrivilegedExceptionAction with privileges enabled and restricted by the specified AccessControlContext and with a privilege scope limited by the specified Permission arguments. This method also preserved the current access control context's domain combiner while the action was performed. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.T - the type of the value returned by the PrivilegedExceptionAction's run methodaction - the action to be performedcontext - ignoredperms - ignoredrun methodPrivilegedActionException - if the specified action's run method threw a checked exceptionNullPointerException - if action is null
public static AccessControlContext getContext()
AccessControlContext where the checkPermission method always throws an AccessControlException and the getDomainCombiner method always returns null.AccessControlContext that fails all permission checks. This method was only useful in conjunction with the Security Manager, which is no longer supported. There is no replacement for the Security Manager or this method.AccessControlContext as specified abovepublic static void checkPermission(Permission perm) throws AccessControlException
AccessControlException.AccessControlContext and security policy. This method has been changed to always throw AccessControlException. This method was only useful in conjunction with the Security Manager, which is no longer supported. There is no replacement for the Security Manager or this method.perm - ignoredAccessControlException - always
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/security/AccessController.html