# Class AccessController

java.lang.Object
java.security.AccessController

@Deprecated(since="17", forRemoval=true) public final class AccessController extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
This class was only useful in conjunction with the Security Manager, which is no longer supported. There is no replacement for the Security Manager or this class.
`AccessController` was used with the Security Manager for access control operations and decisions. This feature no longer exists.

Since:
  1.2

## Method Summary

Modifier and Type
Method
Description
`static void`
`checkPermission(Permission perm)`
Deprecated, for removal: This API element is subject to removal in a future version.
Throws `AccessControlException`.
`static <T> T`
`doPrivileged(PrivilegedAction<T> action)`
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.
`static <T> T`
`doPrivileged(PrivilegedAction<T> action, AccessControlContext context)`
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.
`static <T> T`
`doPrivileged(PrivilegedAction<T> action, AccessControlContext context, Permission... perms)`
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.
`static <T> T`
`doPrivileged(PrivilegedExceptionAction<T> action)`
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.
`static <T> T`
`doPrivileged(PrivilegedExceptionAction<T> action, AccessControlContext context)`
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.
`static <T> T`
`doPrivileged(PrivilegedExceptionAction<T> action, AccessControlContext context, Permission... perms)`
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.
`static <T> T`
`doPrivilegedWithCombiner(PrivilegedAction<T> action)`
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.
`static <T> T`
`doPrivilegedWithCombiner(PrivilegedAction<T> action, AccessControlContext context, Permission... perms)`
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.
`static <T> T`
`doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action)`
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.
`static <T> T`
`doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action, AccessControlContext context, Permission... perms)`
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`.

### Methods declared in class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
Modifier and Type
Method
Description
`protected Object`
`clone()`
Creates and returns a copy of this object.
`boolean`
`equals(Object obj)`
Indicates whether some other object is "equal to" this one.
`protected void`
`finalize()`
Deprecated, for removal: This API element is subject to removal in a future version.
Finalization is deprecated and subject to removal in a future release.
`final Class<?>`
`getClass()`
Returns the runtime class of this `Object`.
`int`
`hashCode()`
Returns a hash code value for this object.
`final void`
`notify()`
Wakes up a single thread that is waiting on this object's monitor.
`final void`
`notifyAll()`
Wakes up all threads that are waiting on this object's monitor.
`String`
`toString()`
Returns a string representation of the object.
`final void`
`wait()`
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
`final void`
`wait(long timeoutMillis)`
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
`final void`
`wait(long timeoutMillis, int nanos)`
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

## Method Details

### doPrivileged

public static <T> T doPrivileged(PrivilegedAction<T> action)
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.

If the action's `run` method throws an (unchecked) exception, it will propagate through this method.

API Note:
  This method originally performed the specified `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.
Type Parameters:
  `T` - the type of the value returned by the PrivilegedAction's `run` method
Parameters:
  `action` - the action to be performed
Returns:
  the value returned by the action's `run` method
Throws:
  `NullPointerException` - if the action is `null`
See Also:
  - `doPrivileged(PrivilegedAction,AccessControlContext)`
  - `doPrivileged(PrivilegedExceptionAction)`

### doPrivilegedWithCombiner

public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action)
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.

If the action's `run` method throws an (unchecked) exception, it will propagate through this method.

API Note:
  This method originally performed the specified `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.
Type Parameters:
  `T` - the type of the value returned by the PrivilegedAction's `run` method
Parameters:
  `action` - the action to be performed
Returns:
  the value returned by the action's `run` method
Throws:
  `NullPointerException` - if the action is `null`
Since:
  1.6

### doPrivileged

public static <T> T doPrivileged(PrivilegedAction<T> action, AccessControlContext context)
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.

If the action's `run` method throws an (unchecked) exception, it will propagate through this method.

API Note:
  This method originally performed the specified `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.
Type Parameters:
  `T` - the type of the value returned by the PrivilegedAction's `run` method
Parameters:
  `action` - the action to be performed.
  `context` - ignored
Returns:
  the value returned by the action's `run` method
Throws:
  `NullPointerException` - if the action is `null`

### doPrivileged

public static <T> T doPrivileged(PrivilegedAction<T> action, AccessControlContext context, Permission... perms)
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.

If the action's `run` method throws an (unchecked) exception, it will propagate through this method.

API Note:
  This method originally performed the specified `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.
Type Parameters:
  `T` - the type of the value returned by the PrivilegedAction's `run` method
Parameters:
  `action` - the action to be performed
  `context` - ignored
  `perms` - ignored
Returns:
  the value returned by the action's `run` method
Throws:
  `NullPointerException` - if action is `null`
Since:
  1.8

### doPrivilegedWithCombiner

public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action, AccessControlContext context, Permission... perms)
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.

If the action's `run` method throws an (unchecked) exception, it will propagate through this method.

API Note:
  This method originally performed the specified `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.
Type Parameters:
  `T` - the type of the value returned by the PrivilegedAction's `run` method
Parameters:
  `action` - the action to be performed
  `context` - ignored
  `perms` - ignored
Returns:
  the value returned by the action's `run` method
Throws:
  `NullPointerException` - if action is `null`
Since:
  1.8

### doPrivileged

public static <T> T doPrivileged(PrivilegedExceptionAction<T> action) throws PrivilegedActionException
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.

If the action's `run` method throws an unchecked exception, it will propagate through this method.

API Note:
  This method originally performed the specified `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.
Type Parameters:
  `T` - the type of the value returned by the PrivilegedExceptionAction's `run` method
Parameters:
  `action` - the action to be performed
Returns:
  the value returned by the action's `run` method
Throws:
  `PrivilegedActionException` - if the specified action's `run` method threw a checked exception
  `NullPointerException` - if the action is `null`

### doPrivilegedWithCombiner

public static <T> T doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action) throws PrivilegedActionException
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.

If the action's `run` method throws an unchecked exception, it will propagate through this method.

API Note:
  This method originally performed the specified `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.
Type Parameters:
  `T` - the type of the value returned by the PrivilegedExceptionAction's `run` method
Parameters:
  `action` - the action to be performed
Returns:
  the value returned by the action's `run` method
Throws:
  `PrivilegedActionException` - if the specified action's `run` method threw a checked exception
  `NullPointerException` - if the action is `null`
Since:
  1.6

### doPrivileged

public static <T> T doPrivileged(PrivilegedExceptionAction<T> action, AccessControlContext context) throws PrivilegedActionException
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.

If the action's `run` method throws an unchecked exception, it will propagate through this method.

API Note:
  This method originally performed the specified `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.
Type Parameters:
  `T` - the type of the value returned by the PrivilegedExceptionAction's `run` method
Parameters:
  `action` - the action to be performed
  `context` - ignored
Returns:
  the value returned by the action's `run` method
Throws:
  `PrivilegedActionException` - if the specified action's `run` method threw a checked exception
  `NullPointerException` - if the action is `null`
See Also:
  - `doPrivileged(PrivilegedAction)`
  - `doPrivileged(PrivilegedAction,AccessControlContext)`

### doPrivileged

public static <T> T doPrivileged(PrivilegedExceptionAction<T> action, AccessControlContext context, Permission... perms) throws PrivilegedActionException
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.

If the action's `run` method throws an (unchecked) exception, it will propagate through this method.

API Note:
  This method originally performed the specified `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.
Type Parameters:
  `T` - the type of the value returned by the PrivilegedExceptionAction's `run` method
Parameters:
  `action` - the action to be performed
  `context` - ignored
  `perms` - ignored
Returns:
  the value returned by the action's `run` method
Throws:
  `PrivilegedActionException` - if the specified action's `run` method threw a checked exception
  `NullPointerException` - if action is `null`
Since:
  1.8

### doPrivilegedWithCombiner

public static <T> T doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action, AccessControlContext context, Permission... perms) throws PrivilegedActionException
Deprecated, for removal: This API element is subject to removal in a future version.
Performs the specified action.

If the action's `run` method throws an (unchecked) exception, it will propagate through this method.

API Note:
  This method originally performed the specified `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.
Type Parameters:
  `T` - the type of the value returned by the PrivilegedExceptionAction's `run` method
Parameters:
  `action` - the action to be performed
  `context` - ignored
  `perms` - ignored
Returns:
  the value returned by the action's `run` method
Throws:
  `PrivilegedActionException` - if the specified action's `run` method threw a checked exception
  `NullPointerException` - if action is `null`
Since:
  1.8

### getContext

public 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`.

API Note:
  This method originally returned a snapshot of the current calling context, which included the current thread's access control context and any limited privilege scope. This method has been changed to always return an innocuous `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.
Returns:
  an `AccessControlContext` as specified above
See Also:
  - `AccessControlContext`

### checkPermission

public static void checkPermission(Permission perm) throws AccessControlException
Deprecated, for removal: This API element is subject to removal in a future version.
Throws `AccessControlException`.

API Note:
  This method originally determined whether the access request indicated by the specified permission should be allowed or denied, based on the current `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.
Parameters:
  `perm` - ignored
Throws:
  `AccessControlException` - always