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.
Checks access to system resources. Supports marking of code as privileged. Makes context snapshots to allow checking from other contexts.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Throws AccessControlException
    static <T> T
    Deprecated, for removal: This API element is subject to removal in a future version.
    Performs the privileged action specified by action.
    static <T> T
    Deprecated, for removal: This API element is subject to removal in a future version.
    Performs the privileged action specified by action.
    static <T> T
    Deprecated, for removal: This API element is subject to removal in a future version.
    Performs the privileged action specified by action.
    static <T> T
    Deprecated, for removal: This API element is subject to removal in a future version.
    Performs the privileged action specified by action.
    static <T> T
    Deprecated, for removal: This API element is subject to removal in a future version.
    Performs the privileged action specified by action.
    static <T> T
    Deprecated, for removal: This API element is subject to removal in a future version.
    Performs the privileged action specified by action.
    static <T> T
    Deprecated, for removal: This API element is subject to removal in a future version.
    Performs the privileged action specified by action, retaining any current DomainCombiner.
    static <T> T
    Deprecated, for removal: This API element is subject to removal in a future version.
    Performs the privileged action specified by action, retaining any current DomainCombiner.
    static <T> T
    Deprecated, for removal: This API element is subject to removal in a future version.
    Performs the privileged action specified by action, retaining any current DomainCombiner.
    static <T> T
    Deprecated, for removal: This API element is subject to removal in a future version.
    Performs the privileged action specified by action, retaining any current DomainCombiner.
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    Answers a string containing a concise, human-readable description of the receiver.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • Method Details

    • 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
      Parameters:
      perm - is ignored
      Throws:
      AccessControlException - is always thrown
    • getContext

      public static AccessControlContext getContext()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      an AccessControlContext with no permissions
    • 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 privileged action specified by 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.

      Type Parameters:
      T - the type of value returned by PrivilegedAction.run
      Parameters:
      action - The PrivilegedAction to performed
      Returns:
      the result of the PrivilegedAction
      Throws:
      NullPointerException - if action is null
      See Also:
    • 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 privileged action specified by 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.

      Type Parameters:
      T - the type of value returned by PrivilegedAction.run
      Parameters:
      action - The PrivilegedAction to performed
      context - The AccessControlContext to check
      Returns:
      the result of the PrivilegedAction
      Throws:
      NullPointerException - if action is null
      See Also:
    • 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 privileged action specified by 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

      Type Parameters:
      T - the type of value returned by PrivilegedExceptionAction.run
      Parameters:
      action - The PrivilegedExceptionAction to performed
      Returns:
      the result of the PrivilegedExceptionAction
      Throws:
      PrivilegedActionException - when a checked exception occurs when performing the action NullPointerException if action is null
      See Also:
    • 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 privileged action specified by 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

      Type Parameters:
      T - the type of value returned by PrivilegedExceptionAction.run
      Parameters:
      action - The PrivilegedExceptionAction to performed
      context - The AccessControlContext to check
      Returns:
      the result of the PrivilegedExceptionAction
      Throws:
      PrivilegedActionException - when a checked exception occurs when performing the action NullPointerException if action is null
      See Also:
    • 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 privileged action specified by 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.

      Type Parameters:
      T - the type of value returned by PrivilegedAction.run
      Parameters:
      action - The PrivilegedAction to performed
      Returns:
      the result of the PrivilegedAction
      See Also:
    • 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 privileged action specified by 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

      Type Parameters:
      T - the type of value returned by PrivilegedExceptionAction.run
      Parameters:
      action - The PrivilegedExceptionAction to performed
      Returns:
      the result of the PrivilegedExceptionAction
      Throws:
      PrivilegedActionException - when a checked exception occurs when performing the action
      See Also:
    • 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 privileged action specified by 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.

      Type Parameters:
      T - the type of value returned by PrivilegedAction.run
      Parameters:
      action - The PrivilegedAction to performed
      context - The AccessControlContext to check
      perms - The Permission arguments to limit the scope of the caller's privileges.
      Returns:
      the result of the PrivilegedAction
      Throws:
      NullPointerException - if action is null
      Since:
      1.8
      See Also:
    • 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 privileged action specified by 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.

      Type Parameters:
      T - the type of value returned by PrivilegedAction.run
      Parameters:
      action - The PrivilegedAction to performed
      context - The AccessControlContext to check
      perms - The Permission arguments to limit the scope of the caller's privileges.
      Returns:
      the result of the PrivilegedAction
      Since:
      1.8
      See Also:
    • 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 privileged action specified by 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

      Type Parameters:
      T - the type of value returned by PrivilegedExceptionAction.run
      Parameters:
      action - The PrivilegedExceptionAction to performed
      context - The AccessControlContext to check
      perms - The Permission arguments to limit the scope of the caller's privileges.
      Returns:
      the result of the PrivilegedExceptionAction
      Throws:
      PrivilegedActionException - when a checked exception occurs when performing the action NullPointerException if action is null
      Since:
      1.8
      See Also:
    • 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 privileged action specified by 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

      Type Parameters:
      T - the type of value returned by PrivilegedExceptionAction.run
      Parameters:
      action - The PrivilegedExceptionAction to performed
      context - The AccessControlContext to check
      perms - The Permission arguments to limit the scope of the caller's privileges.
      Returns:
      the result of the PrivilegedExceptionAction
      Throws:
      PrivilegedActionException - when a checked exception occurs when performing the action
      Since:
      1.8
      See Also: