The checkPermission method of the PolicyEngine Class contains the following signatures:
checkPermission(PermissionID pid)
checkPermission(String pname)
checkPermission(PermissionID pid,Object sreq)
checkPermission(String pname,Object sreq)
checkPermission(ISecurityRequest sreq)
Performs a simple (non-parameterized) security check for a specified type of permission. For the security check to pass, all the callers on the call stack must possess the specified type of permission.
public static void checkPermission(PermissionID pid);
Note Permission assertions and denials might affect the stack crawl, which could cause it to terminate early without examining the entire stack.
pid | The type of permission to check for. |
SecurityException if the security check fails.
Performs a simple (non-parameterized) security check for a specified type of permission. A permission name is used to specify the permission type. For the security check to pass, all the callers on the call stack must possess the specified type of permission.
public static void checkPermission(String pname);
Note Permission assertions and denials might affect the stack crawl, causing it to terminate early without examining the entire stack.
pname | The name of the permission to check for. |
SecurityException if the security check fails.
Performs a parameterized security check for a specific type of permission.
public static void checkPermission(PermissionID pid,Object sreq);
pid | The type of permission to check for. |
sreq | The security request object that indicates the specific resource to check for within the realm of the permission type. The type of this object depends on the type of the permission being checked. |
For the security check to pass, all the callers on the call stack must possess the specified type of permission. In addition, all the permission objects associated with the calling class types found on the stack must validate that the operation indicated by the security request object is allowed. Validation is accomplished by calling the IPermission.check method of all the found permission instances.
Note Permission assertions and denials might affect the stack crawl, causing it to terminate early without examining the entire stack.
SecurityException if the security check fails.
Performs a parameterized security check for a specific type of permission. A permission name is used to specify the permission type (instead of a PermissionID).
public static void checkPermission(String pname,Object sreq);
pname | The name of the permission to check for. |
sreq | The security request object that indicates the specific resource to check for within the realm of the permission type. The type of this object depends on the type of the permission being checked. |
For the security check to pass, all the callers on the call stack must possess the specified type of permission. In addition, all the permission objects associated with the calling class types found on the stack must validate that the operation indicated by the security request object is allowed. Validation is accomplished by calling the IPermission.check method of all the found permission instances.
Note Permission assertions and denials might affect the stack crawl, causing it to terminate early without examining the entire stack.
SecurityException if the security check fails.
Performs a parameterized security check for a specific type of permission. This method is a variation on the checkPermission(PermissionID,Object) method where the sreq parameter is used to determine the permission type and is also used as the security request object.
public static void checkPermission(ISecurityRequest sreq);
Calling the checkPermission(ISecurityRequest) method is equivalent to the following call:
checkPermission(sreq.getPermissionID(),sreq);
sreq | The object that determines the permission type and indicates the resource to check for. |
SecurityException if the security check fails.
checkPermission(PermissionID,Object)