|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.security.AccessControlContext
An 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 AccessControlContext
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
Constructor Summary | |
AccessControlContext(ProtectionDomain[] context)
Create an AccessControlContext with the given set of ProtectionDomains. |
Method Summary | |
void |
checkPermission(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. |
boolean |
equals(Object obj)
Checks two AccessControlContext objects for equality. |
int |
hashCode()
Returns the hash code value for this context. |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public AccessControlContext(ProtectionDomain[] context)
context
- the ProtectionDomains associated with this context.Method Detail |
public void checkPermission(Permission perm) throws AccessControlException
This method quietly returns if the access request is permitted, or throws a suitable AccessControlException otherwise.
perm
- the requested permission.public boolean equals(Object obj)
obj
- the object we are testing for equality with this object.public int hashCode()
|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |