Edit

Share via


IPermission Interface

Definition

Caution

Code Access Security is not supported or honored by the runtime.

Defines methods implemented by permission types.

public interface class IPermission : System::Security::ISecurityEncodable
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public interface IPermission : System.Security.ISecurityEncodable
public interface IPermission : System.Security.ISecurityEncodable
[System.Runtime.InteropServices.ComVisible(true)]
public interface IPermission : System.Security.ISecurityEncodable
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type IPermission = interface
    interface ISecurityEncodable
type IPermission = interface
    interface ISecurityEncodable
[<System.Runtime.InteropServices.ComVisible(true)>]
type IPermission = interface
    interface ISecurityEncodable
Public Interface IPermission
Implements ISecurityEncodable
Derived
Attributes
Implements

Remarks

Caution

Code Access Security (CAS) has been deprecated across all versions of .NET Framework and .NET. Recent versions of .NET do not honor CAS annotations and produce errors if CAS-related APIs are used. Developers should seek alternative means of accomplishing security tasks.

Permissions in the common language runtime are objects that describe sets of operations that can be secured for specified resources. A permission object describes operations or access that is subject to security control; it does not represent access or a right to perform operations. Permissions are used by both application code and the .NET Framework security system in the following ways:

  • Code requests the permissions it needs in order to run.
  • The security system policy grants permissions to code in order for it to run.
  • Code demands that calling code has a permission.
  • Code overrides the security stack using assert/deny/permit-only.

Note

If you write a new permission, you must implement this interface in your class.

Important

A permission can be accessed by multiple threads. When implementing this interface, you must guarantee that the IsSubsetOf, Intersect, Union, and Copy method implementations are thread safe.

Methods

Copy()

Creates and returns an identical copy of the current permission.

Demand()

Throws a SecurityException at run time if the security requirement is not met.

FromXml(SecurityElement)

Reconstructs a security object with a specified state from an XML encoding.

(Inherited from ISecurityEncodable)
Intersect(IPermission)

Creates and returns a permission that is the intersection of the current permission and the specified permission.

IsSubsetOf(IPermission)

Determines whether the current permission is a subset of the specified permission.

ToXml()

Creates an XML encoding of the security object and its current state.

(Inherited from ISecurityEncodable)
Union(IPermission)

Creates a permission that is the union of the current permission and the specified permission.

Applies to