< prev index next >

## src/java.base/share/classes/java/security/AccessController.java

Print this page

     254  *             // context have the desired permission. If a requested
     255  *             // permission is not implied by the limiting FilePermission
     256  *             // argument then checking of the thread continues beyond the
     257  *             // caller of doPrivileged.
     258  *         }
     259  *     }, acc, new FilePermission("/temp/*", read));
     260  *     ...normal code here...
     261  * }}</pre>
     262  * <p> Passing a limiting {@code Permission} argument of an instance of
     263  * {@code AllPermission} is equivalent to calling the equivalent
     264  * {@code doPrivileged} method without limiting {@code Permission}
     265  * arguments. Passing a zero length array of {@code Permission} disables
     266  * the code privileges so that checking always continues beyond the caller of
     267  * that {@code doPrivileged} method.
     268  *
     269  * @see AccessControlContext
     270  *
     271  * @author Li Gong
     272  * @author Roland Schemers
     273  * @since 1.2

     274  */
     275

     276 public final class AccessController {
     277
     278     /**
     279      * Don't allow anyone to instantiate an AccessController
     280      */
     281     private AccessController() { }
     282
     283     /**
     284      * Performs the specified {@code PrivilegedAction} with privileges
     285      * enabled. The action is performed with <i>all</i> of the permissions
     286      * possessed by the caller's protection domain.
     287      *
     288      * <p> If the action's {@code run} method throws an (unchecked)
     289      * exception, it will propagate through this method.
     290      *
     291      * <p> Note that any DomainCombiner associated with the current
     292      * AccessControlContext will be ignored while the action is performed.
     293      *
     294      * @param <T> the type of the value returned by the PrivilegedAction's
     295      *                  {@code run} method.
     254  *             // context have the desired permission. If a requested
     255  *             // permission is not implied by the limiting FilePermission
     256  *             // argument then checking of the thread continues beyond the
     257  *             // caller of doPrivileged.
     258  *         }
     259  *     }, acc, new FilePermission("/temp/*", read));
     260  *     ...normal code here...
     261  * }}</pre>
     262  * <p> Passing a limiting {@code Permission} argument of an instance of
     263  * {@code AllPermission} is equivalent to calling the equivalent
     264  * {@code doPrivileged} method without limiting {@code Permission}
     265  * arguments. Passing a zero length array of {@code Permission} disables
     266  * the code privileges so that checking always continues beyond the caller of
     267  * that {@code doPrivileged} method.
     268  *
     269  * @see AccessControlContext
     270  *
     271  * @author Li Gong
     272  * @author Roland Schemers
     273  * @since 1.2
     274  * @deprecated This class is only useful in conjunction with
     275  *       {@linkplain SecurityManager the Security Manager}, which is deprecated
     276  *       and subject to removal in a future release. Consequently, this class
     277  *       is also deprecated and subject to removal. There is no replacement for
     278  *       the Security Manager or this class.
     279  */
     280
     281 @Deprecated(since="17", forRemoval=true)
     282 public final class AccessController {
     283
     284     /**
     285      * Don't allow anyone to instantiate an AccessController
     286      */
     287     private AccessController() { }
     288
     289     /**
     290      * Performs the specified {@code PrivilegedAction} with privileges
     291      * enabled. The action is performed with <i>all</i> of the permissions
     292      * possessed by the caller's protection domain.
     293      *
     294      * <p> If the action's {@code run} method throws an (unchecked)
     295      * exception, it will propagate through this method.
     296      *
     297      * <p> Note that any DomainCombiner associated with the current
     298      * AccessControlContext will be ignored while the action is performed.
     299      *
     300      * @param <T> the type of the value returned by the PrivilegedAction's
     301      *                  {@code run} method.

< prev index next >