src/share/classes/java/security/AccessControlContext.java

Print this page

        

*** 34,69 **** /** * An AccessControlContext is used to make system resource access decisions * based on the context it encapsulates. * * <p>More specifically, it encapsulates a context and ! * has a single method, <code>checkPermission</code>, ! * that is equivalent to the <code>checkPermission</code> method * in the AccessController class, with one difference: The AccessControlContext ! * <code>checkPermission</code> method makes access decisions based on the * context it encapsulates, * rather than that of the current execution thread. * * <p>Thus, the purpose of AccessControlContext is for those situations where * a security check that should be made within a given context * actually needs to be done from within a * <i>different</i> context (for example, from within a worker thread). * * <p> An AccessControlContext is created by calling the ! * <code>AccessController.getContext</code> method. ! * The <code>getContext</code> method takes a "snapshot" * of the current calling context, and places * it in an AccessControlContext object, which it returns. A sample call is * the following: * * <pre> * AccessControlContext acc = AccessController.getContext() * </pre> * * <p> * Code within a different context can subsequently call the ! * <code>checkPermission</code> method on the * previously-saved AccessControlContext object. A sample call is the * following: * * <pre> * acc.checkPermission(permission) --- 34,69 ---- /** * An AccessControlContext is used to make system resource access decisions * based on the context it encapsulates. * * <p>More specifically, it encapsulates a context and ! * has a single method, {@code checkPermission}, ! * that is equivalent to the {@code checkPermission} method * in the AccessController class, with one difference: The AccessControlContext ! * {@code checkPermission} method makes access decisions based on the * context it encapsulates, * rather than that of the current execution thread. * * <p>Thus, the purpose of AccessControlContext is for those situations where * a security check that should be made within a given context * actually needs to be done from within a * <i>different</i> context (for example, from within a worker thread). * * <p> An AccessControlContext is created by calling the ! * {@code AccessController.getContext} method. ! * The {@code getContext} method takes a "snapshot" * of the current calling context, and places * it in an AccessControlContext object, which it returns. A sample call is * the following: * * <pre> * AccessControlContext acc = AccessController.getContext() * </pre> * * <p> * Code within a different context can subsequently call the ! * {@code checkPermission} method on the * previously-saved AccessControlContext object. A sample call is the * following: * * <pre> * acc.checkPermission(permission)
*** 119,129 **** * context. * * @param context the ProtectionDomains associated with this context. * The non-duplicate domains are copied from the array. Subsequent * changes to the array will not affect this AccessControlContext. ! * @throws NullPointerException if <code>context</code> is <code>null</code> */ public AccessControlContext(ProtectionDomain context[]) { if (context.length == 0) { this.context = null; --- 119,129 ---- * context. * * @param context the ProtectionDomains associated with this context. * The non-duplicate domains are copied from the array. Subsequent * changes to the array will not affect this AccessControlContext. ! * @throws NullPointerException if {@code context} is {@code null} */ public AccessControlContext(ProtectionDomain context[]) { if (context.length == 0) { this.context = null;
*** 145,170 **** } } } /** ! * Create a new <code>AccessControlContext</code> with the given ! * <code>AccessControlContext</code> and <code>DomainCombiner</code>. * This constructor associates the provided ! * <code>DomainCombiner</code> with the provided ! * <code>AccessControlContext</code>. * * <p> * ! * @param acc the <code>AccessControlContext</code> associated ! * with the provided <code>DomainCombiner</code>. * ! * @param combiner the <code>DomainCombiner</code> to be associated ! * with the provided <code>AccessControlContext</code>. * * @exception NullPointerException if the provided ! * <code>context</code> is <code>null</code>. * * @exception SecurityException if a security manager is installed and the * caller does not have the "createAccessControlContext" * {@link SecurityPermission} * @since 1.3 --- 145,170 ---- } } } /** ! * Create a new {@code AccessControlContext} with the given ! * {@code AccessControlContext} and {@code DomainCombiner}. * This constructor associates the provided ! * {@code DomainCombiner} with the provided ! * {@code AccessControlContext}. * * <p> * ! * @param acc the {@code AccessControlContext} associated ! * with the provided {@code DomainCombiner}. * ! * @param combiner the {@code DomainCombiner} to be associated ! * with the provided {@code AccessControlContext}. * * @exception NullPointerException if the provided ! * {@code context} is {@code null}. * * @exception SecurityException if a security manager is installed and the * caller does not have the "createAccessControlContext" * {@link SecurityPermission} * @since 1.3
*** 318,334 **** } return null; } /** ! * Get the <code>DomainCombiner</code> associated with this ! * <code>AccessControlContext</code>. * * <p> * ! * @return the <code>DomainCombiner</code> associated with this ! * <code>AccessControlContext</code>, or <code>null</code> * if there is none. * * @exception SecurityException if a security manager is installed and * the caller does not have the "getDomainCombiner" * {@link SecurityPermission} --- 318,334 ---- } return null; } /** ! * Get the {@code DomainCombiner} associated with this ! * {@code AccessControlContext}. * * <p> * ! * @return the {@code DomainCombiner} associated with this ! * {@code AccessControlContext}, or {@code null} * if there is none. * * @exception SecurityException if a security manager is installed and * the caller does not have the "getDomainCombiner" * {@link SecurityPermission}