AccessControlContext is used to make system resource access
 decisions based on the context it encapsulates.
 More specifically, it encapsulates a context and
 has a single method, checkPermission,
 that is equivalent to the checkPermission method
 in the AccessController class, with one difference:
 The checkPermission method makes access decisions based on the
 context it encapsulates,
 rather than that of the current execution thread.
 
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
 different context (for example, from within a worker thread).
 
 An AccessControlContext is created by calling the
 AccessController.getContext method.
 The 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:
 
AccessControlContext acc = AccessController.getContext()
 Code within a different context can subsequently call the
 checkPermission method on the
 previously-saved AccessControlContext object. A sample call is the
 following:
 
acc.checkPermission(permission)
- Since:
- 1.2
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionAccessControlContext(AccessControlContext acc, DomainCombiner combiner) Deprecated, for removal: This API element is subject to removal in a future version.Create a newAccessControlContextwith the givenAccessControlContextandDomainCombiner.AccessControlContext(ProtectionDomain[] context) Deprecated, for removal: This API element is subject to removal in a future version.Create anAccessControlContextwith the given array ofProtectionDomainobjects.
- 
Method SummaryModifier and TypeMethodDescriptionvoidcheckPermission(Permission perm) Deprecated, for removal: This API element is subject to removal in a future version.Determines whether the access request indicated by the specified permission should be allowed or denied, based on the security policy currently in effect, and the context in this object.booleanDeprecated, for removal: This API element is subject to removal in a future version.Checks twoAccessControlContextobjects for equality.Deprecated, for removal: This API element is subject to removal in a future version.Get theDomainCombinerassociated with thisAccessControlContext.inthashCode()Deprecated, for removal: This API element is subject to removal in a future version.Returns the hash code value for this context.
- 
Constructor Details- 
AccessControlContextDeprecated, for removal: This API element is subject to removal in a future version.Create anAccessControlContextwith the given array ofProtectionDomainobjects. Context must not benull. Duplicate domains will be removed from the context.- Parameters:
- context- the- ProtectionDomainobjects 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- contextis- null
 
- 
AccessControlContextDeprecated, for removal: This API element is subject to removal in a future version.Create a newAccessControlContextwith the givenAccessControlContextandDomainCombiner. This constructor associates the providedDomainCombinerwith the providedAccessControlContext.- Parameters:
- acc- the- AccessControlContextassociated with the provided- DomainCombiner.
- combiner- the- DomainCombinerto be associated with the provided- AccessControlContext.
- Throws:
- NullPointerException- if the provided- contextis- null.
- SecurityException- if a security manager is installed and the caller does not have the "createAccessControlContext"- SecurityPermission
- Since:
- 1.3
 
 
- 
- 
Method Details- 
getDomainCombinerDeprecated, for removal: This API element is subject to removal in a future version.Get theDomainCombinerassociated with thisAccessControlContext.- Returns:
- the DomainCombinerassociated with thisAccessControlContext, ornullif there is none.
- Throws:
- SecurityException- if a security manager is installed and the caller does not have the "getDomainCombiner"- SecurityPermission
- Since:
- 1.3
 
- 
checkPermissionDeprecated, for removal: This API element is subject to removal in a future version.Determines whether the access request indicated by the specified permission should be allowed or denied, based on the security policy currently in effect, and the context in this object. The request is allowed only if everyProtectionDomainin the context implies the permission. Otherwise the request is denied.This method quietly returns if the access request is permitted, or throws a suitable AccessControlExceptionotherwise.- Parameters:
- perm- the requested permission.
- Throws:
- AccessControlException- if the specified permission is not permitted, based on the current security policy and the context encapsulated by this object.
- NullPointerException- if the permission to check for is- null.
 
- 
equalsDeprecated, for removal: This API element is subject to removal in a future version.Checks twoAccessControlContextobjects for equality. Checks thatobjis anAccessControlContextand has the same set ofProtectionDomainobjects as this context.
- 
hashCodepublic int hashCode()Deprecated, for removal: This API element is subject to removal in a future version.Returns the hash code value for this context. The hash code is computed by exclusive or-ing the hash code of all the protection domains in the context together.
 
-