<PackageReference Include="System.Security.Permissions" Version="9.0.6" />

PrincipalPermission

Allows checks against the active principal (see IPrincipal) using the language constructs defined for both declarative and imperative security actions. This class cannot be inherited.

Initializes a new instance of the PrincipalPermission class with the specified PermissionState.

public PrincipalPermission(string name, string role)

Initializes a new instance of the PrincipalPermission class for the specified name and role.

public PrincipalPermission(string name, string role, bool isAuthenticated)

Initializes a new instance of the PrincipalPermission class for the specified name, role, and authentication status.

public IPermission Copy()

Creates and returns an identical copy of the current permission.

public void Demand()

Determines at run time whether the current principal matches the principal specified by the current permission.

public void FromXml(SecurityElement elem)

Reconstructs a permission with a specified state from an XML encoding.

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

public bool IsSubsetOf(IPermission target)

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

public bool IsUnrestricted()

Returns a value indicating whether the current permission is unrestricted.

Creates an XML encoding of the permission and its current state.

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