Packages
 In this topic

*Methods

 

Packages   PreviousThis Package
Package com.ms.security   Previous This
Package

 


Interface ISecurityRequest

public interface ISecurityRequest
{
  // Methods
  PermissionID getPermissionID();
}

This interface is used to associate specific types of objects with specific permission types.

For parameterized security checks, the basic PolicyEngine APIs require you to specify both the type of permission to check, and the security request object to pass to the IPermission.check methods. However, there are also variations of the PolicyEngine check methods that take an ISecurityRequest object instead. The ISecurityRequest object identifies the permission type and also represents the security request object.

For example, the FileIORequest class implements the ISecurityRequest interface (returning PermissionID.FILEIO), so the following security checks are equivalent to each other.


  ...
  // Create an ISecurityRequest object.
  FileIORequest sreq = new FileIORequest(FileIORequest.READ,"c:\\MySample.txt");

  // The first security check. 
  // The permission type is explicitly specified.
  // Use the checkPermission(PermissionID,Object) method
  // to check permissions. 
  PolicyEngine.checkPermission(PermissionID.FILEIO,sreq);

  // The second security check.
  // PolicyEngine determines the permission type from
  // the FileIORequest object. It performs the same check as
  // above.
  //
  // Use the checkPermission(ISecurityRequest) method
  // to check permissions.  
  PolicyEngine.checkPermission(sreq);    
	

Methods

getPermissionID

PermissionID getPermissionID();

Retrieves the permission type associated with the object.

Return Value:

Returns the permission type associated with the object.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.