Deprecated
for removal since 17.
This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this class is also deprecated and subject to removal. There is no replacement for the Security Manager or this class.
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)
AccessController
Modifier and Type | Field and Description |
---|---|
private DomainCombiner | combiner
References Deprecated
DomainCombiner is deprecated or references (maybe indirectly) at least one deprecated element.
|
private ProtectionDomain[] | |
private static Debug | |
private static boolean | |
private boolean | |
private boolean | |
private boolean | |
private boolean | |
private ProtectionDomain[] | |
private AccessControlContext | parent
References Deprecated
AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.
|
private Permission[] | |
private AccessControlContext | privilegedContext
References Deprecated
AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.
|
Access | Constructor and Description |
---|---|
public | AccessControlContext(ProtectionDomain[]
the context)ProtectionDomain objects associated with this
context. The non-duplicate domains are copied from the array. Subsequent
changes to the array will not affect this AccessControlContext .Create an |
public | AccessControlContext(AccessControlContext
the acc, DomainCombiner AccessControlContext associated
with the provided DomainCombiner .the combiner)DomainCombiner to be associated
with the provided AccessControlContext .
References Deprecated
AccessControlContext and DomainCombiner are deprecated or reference (maybe indirectly) at least one deprecated element.
Create a new |
pack-priv | AccessControlContext(AccessControlContext acc, DomainCombiner combiner, boolean preauthorized)
References Deprecated
AccessControlContext and DomainCombiner are deprecated or reference (maybe indirectly) at least one deprecated element.
package private to allow calls from |
pack-priv | AccessControlContext(ProtectionDomain caller, DomainCombiner combiner, AccessControlContext parent, AccessControlContext context, Permission[] perms)
References Deprecated
DomainCombiner and AccessControlContext are deprecated or reference (maybe indirectly) at least one deprecated element.
package private for |
pack-priv | AccessControlContext(ProtectionDomain[] context, boolean isPrivileged)
package private constructor for |
pack-priv | AccessControlContext(ProtectionDomain[] context, AccessControlContext privilegedContext)
References Deprecated
AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.
Constructor for |
Modifier and Type | Method and Description |
---|---|
private void | calculateFields(AccessControlContext assigned, AccessControlContext parent, Permission[] permissions)
References Deprecated
AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.
|
public void | checkPermission(Permission
the requested permission. perm)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. |
private void | |
private static ProtectionDomain[] | |
private boolean | containsAllLimits(AccessControlContext that)
References Deprecated
AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.
|
private static boolean | |
private boolean | equalContext(AccessControlContext that)
References Deprecated
AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.
|
private boolean | equalLimitedContext(AccessControlContext that)
References Deprecated
AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.
|
private boolean | |
public boolean | Returns: true if obj is an AccessControlContext ,
and has the same set of ProtectionDomain objects as this context,
false otherwise.the object we are testing for equality with this object. obj)Overrides java. Checks two |
pack-priv DomainCombiner | getAssignedCombiner()
References Deprecated
DomainCombiner is deprecated or references (maybe indirectly) at least one deprecated element.
get the assigned combiner from the privileged or inherited context |
pack-priv DomainCombiner | getCombiner()
References Deprecated
DomainCombiner is deprecated or references (maybe indirectly) at least one deprecated element.
package private for |
pack-priv ProtectionDomain[] | |
pack-priv static Debug | |
public DomainCombiner | Returns: theDomainCombiner associated with this
AccessControlContext , or null
if there is none.
References Deprecated
DomainCombiner is deprecated or references (maybe indirectly) at least one deprecated element.
Get the |
private static AccessControlContext | getNextPC(AccessControlContext acc)
References Deprecated
AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.
|
public int | Returns: the hash code value for this contextOverrides java. Returns the hash code value for this context. |
pack-priv boolean | |
pack-priv boolean | |
pack-priv AccessControlContext | optimize()
References Deprecated
AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.
Take the stack-based context (this) and combine it with the privileged or inherited context, if need be. |
combiner | back to summary |
---|---|
private DomainCombiner combiner
References Deprecated
See corresponding docs for further information.
|
context | back to summary |
---|---|
private ProtectionDomain[] context |
debug | back to summary |
---|---|
private static Debug debug |
debugInit | back to summary |
---|---|
private static boolean debugInit |
isAuthorized | back to summary |
---|---|
private boolean isAuthorized |
isLimited | back to summary |
---|---|
private boolean isLimited |
isPrivileged | back to summary |
---|---|
private boolean isPrivileged |
isWrapped | back to summary |
---|---|
private boolean isWrapped |
limitedContext | back to summary |
---|---|
private ProtectionDomain[] limitedContext |
parent | back to summary |
---|---|
private AccessControlContext parent
References Deprecated
See corresponding docs for further information. |
permissions | back to summary |
---|---|
private Permission[] permissions |
privilegedContext | back to summary |
---|---|
private AccessControlContext privilegedContext
References Deprecated
See corresponding docs for further information. |
AccessControlContext | back to summary |
---|---|
public AccessControlContext(ProtectionDomain[] context) Create an
|
AccessControlContext | back to summary |
---|---|
public AccessControlContext(AccessControlContext acc, DomainCombiner combiner)
References Deprecated
See corresponding docs for further information. Create a new
|
AccessControlContext | back to summary |
---|---|
pack-priv AccessControlContext(AccessControlContext acc, DomainCombiner combiner, boolean preauthorized)
References Deprecated
See corresponding docs for further information. package private to allow calls from |
AccessControlContext | back to summary |
---|---|
pack-priv AccessControlContext(ProtectionDomain caller, DomainCombiner combiner, AccessControlContext parent, AccessControlContext context, Permission[] perms)
References Deprecated
See corresponding docs for further information. package private for |
AccessControlContext | back to summary |
---|---|
pack-priv AccessControlContext(ProtectionDomain[] context, boolean isPrivileged) package private constructor for |
AccessControlContext | back to summary |
---|---|
pack-priv AccessControlContext(ProtectionDomain[] context, AccessControlContext privilegedContext)
References Deprecated
See corresponding docs for further information. Constructor for |
calculateFields | back to summary |
---|---|
private void calculateFields(AccessControlContext assigned, AccessControlContext parent, Permission[] permissions)
References Deprecated
See corresponding docs for further information. |
checkPermission | back to summary |
---|---|
public void checkPermission(Permission perm) throws AccessControlException 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 every
This method quietly returns if the access request
is permitted, or throws a suitable
|
checkPermission2 | back to summary |
---|---|
private void checkPermission2(Permission perm) |
combine | back to summary |
---|---|
private static ProtectionDomain[] combine(ProtectionDomain[] current, ProtectionDomain[] assigned) |
containsAllLimits | back to summary |
---|---|
private boolean containsAllLimits(AccessControlContext that)
References Deprecated
See corresponding docs for further information. |
containsAllPDs | back to summary |
---|---|
private static boolean containsAllPDs(ProtectionDomain[] thisContext, ProtectionDomain[] thatContext) |
equalContext | back to summary |
---|---|
private boolean equalContext(AccessControlContext that)
References Deprecated
See corresponding docs for further information. |
equalLimitedContext | back to summary |
---|---|
private boolean equalLimitedContext(AccessControlContext that)
References Deprecated
See corresponding docs for further information. |
equalPDs | back to summary |
---|---|
private boolean equalPDs(ProtectionDomain[] a, ProtectionDomain[] b) |
equals | back to summary |
---|---|
public boolean equals(Object obj) Overrides java. Checks two |
getAssignedCombiner | back to summary |
---|---|
pack-priv DomainCombiner getAssignedCombiner()
References Deprecated
See corresponding docs for further information. get the assigned combiner from the privileged or inherited context
|
getCombiner | back to summary |
---|---|
pack-priv DomainCombiner getCombiner()
References Deprecated
See corresponding docs for further information. package private for
|
getContext | back to summary |
---|---|
pack-priv ProtectionDomain[] getContext() Returns this context's context. |
getDebug | back to summary |
---|---|
pack-priv static Debug getDebug()
|
getDomainCombiner | back to summary |
---|---|
public DomainCombiner getDomainCombiner()
References Deprecated
See corresponding docs for further information. Get the
|
getNextPC | back to summary |
---|---|
private static AccessControlContext getNextPC(AccessControlContext acc)
References Deprecated
See corresponding docs for further information. |
hashCode | back to summary |
---|---|
public int hashCode() Overrides java. 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.
|
isAuthorized | back to summary |
---|---|
pack-priv boolean isAuthorized() |
isPrivileged | back to summary |
---|---|
pack-priv boolean isPrivileged() Returns |
optimize | back to summary |
---|---|
pack-priv AccessControlContext optimize()
References Deprecated
See corresponding docs for further information. Take the stack-based context (this) and combine it with the privileged or inherited context, if need be. Any limited privilege scope is flagged regardless of whether the assigned context comes from an immediately enclosing limited doPrivileged(). The limited privilege scope can indirectly flow from the inherited parent thread or an assigned context previously captured by getContext().
|