Microsoft SDK for Java

checkPermission

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)

checkPermission(PermissionID pid)

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.

Syntax

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.

Parameters

pid The type of permission to check for.

Exceptions

SecurityException if the security check fails.

checkPermission(String pname)

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.

Syntax

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.

Parameters

pname The name of the permission to check for.

Exceptions

SecurityException if the security check fails.

checkPermission(PermissionID pid,Object sreq)

Performs a parameterized security check for a specific type of permission.

Syntax

public static void checkPermission(PermissionID pid,Object sreq);

Parameters

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.

Remarks

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.

Exceptions

SecurityException if the security check fails.

checkPermission(String pname,Object sreq)

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).

Syntax

public static void checkPermission(String pname,Object sreq);

Parameters

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.

Remarks

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.

Exceptions

SecurityException if the security check fails.

checkPermission(ISecurityRequest sreq)

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.

Syntax

public static void checkPermission(ISecurityRequest sreq);

Calling the checkPermission(ISecurityRequest) method is equivalent to the following call:

   checkPermission(sreq.getPermissionID(),sreq);

Parameters

sreq The object that determines the permission type and indicates the resource to check for.

Exceptions

SecurityException if the security check fails.

See Also

checkPermission(PermissionID,Object)

© 1999 Microsoft Corporation. All rights reserved. Terms of use.