Checks access to system resources. Supports marking of code as priveleged. Makes context snapshots to allow checking from other contexts.
Static Public Member Functions | |
static void | checkPermission (Permission perm) throws AccessControlException |
Checks whether the running program is allowed to access the resource being guarded by the given Permission argument. | |
static AccessControlContext | getContext () |
Answers the access controller context of the current thread, including the inherited ones. | |
static Object | doPrivileged (PrivilegedAction action) |
Performs the privileged action specified by action . | |
static Object | doPrivileged (PrivilegedAction action, AccessControlContext context) |
Performs the privileged action specified by action . | |
static Object | doPrivileged (PrivilegedExceptionAction action) throws PrivilegedActionException |
Performs the privileged action specified by action . | |
static Object | doPrivileged (PrivilegedExceptionAction action, AccessControlContext context) throws PrivilegedActionException |
Performs the privileged action specified by action . | |
Static Package Functions | |
[static initializer] | |
Private Member Functions | |
AccessController () | |
Prevents this class from being instantiated. | |
Static Private Member Functions | |
static native void | initializeInternal () |
static native Object[] | getProtectionDomains (int depth) |
This native must be implemented to use the reference implementation of this class. | |
static void | keepalive (AccessControlContext context) |
Used to keep the context live during doPrivileged(). | |
static ProtectionDomain[] | toArrayOfProtectionDomains (Object[] domains, AccessControlContext acc) |
|
Prevents this class from being instantiated.
|
|
This native must be implemented to use the reference implementation of this class. It is used by checkPermission() and getContext(), which call this native with depth = 1. Returns an array of ProtectionDomain from the classes on the stack, from the specified depth up to the first privileged frame, or the end of the stack if there is not a privileged frame. The array may be larger than required, but must be null terminated. As bootstrap classes have all permissions, bootstrap class frames SHOULD be skipped. Bootstrap class frames MUST be skipped if the ProtectionDomain of bootstrap classes is null. Duplicate ProtectionDomains SHOULD be removed. The first element of the result is the AccessControlContext, which may be null, either from the privileged frame, or from the current Thread if there is not a privileged frame. A privileged frame is any frame running one of the following methods:
|
|
Checks whether the running program is allowed to access the resource being guarded by the given Permission argument.
|
|
Used to keep the context live during doPrivileged().
|
|
Answers the access controller context of the current thread, including the inherited ones.
It basically retrieves all the protection domains from the calling stack and creates an
|
|
Performs the privileged action specified by When permission checks are made, if the permission has been granted by all frames below and including the one representing the call to this method, then the permission is granted. In otherwords, the check stops here. Any unchecked exception generated by this method will propagate up the chain.
|
|
Performs the privileged action specified by
When permission checks are made, if the permission has been granted by all frames below and including the one representing the call to this method, then the permission is granted iff it is granted by the AccessControlContext Any unchecked exception generated by this method will propagate up the chain.
|
|
Performs the privileged action specified by When permission checks are made, if the permission has been granted by all frames below and including the one representing the call to this method, then the permission is granted. In otherwords, the check stops here. Any unchecked exception generated by this method will propagate up the chain. However, checked exceptions will be caught an re-thrown as PrivilegedActionExceptions
|
|
Performs the privileged action specified by
When permission checks are made, if the permission has been granted by all frames below and including the one representing the call to this method, then the permission is granted iff it is granted by the AccessControlContext Any unchecked exception generated by this method will propagate up the chain. However, checked exceptions will be caught an re-thrown as PrivilegedActionExceptions
|