<PackageReference Include="System.Security.Permissions" Version="6.0.0-preview.2.21154.6" />

SecurityManager

public static class SecurityManager
Provides the main access point for classes interacting with the security system. This class cannot be inherited.
public static bool CheckExecutionRights { get; set; }

Gets or sets a value indicating whether code must have Execution in order to execute.

public static bool SecurityEnabled { get; set; }

Gets or sets a value indicating whether security is enabled.

Determines whether the current thread requires a security context capture if its security state has to be re-created at a later point in time.

public static PermissionSet GetStandardSandbox(Evidence evidence)

Gets a permission set that is safe to grant to an application that has the provided evidence.

public static void GetZoneAndOrigin(out ArrayList zone, out ArrayList origin)

Gets the granted zone identity and URL identity permission sets for the current assembly.

public static bool IsGranted(IPermission perm)

Determines whether a permission is granted to the caller.

public static PolicyLevel LoadPolicyLevelFromFile(string path, PolicyLevelType type)

Loads a PolicyLevel from the specified file.

public static PolicyLevel LoadPolicyLevelFromString(string str, PolicyLevelType type)

Loads a PolicyLevel from the specified string.

public static IEnumerator PolicyHierarchy()

Provides an enumerator to access the security policy hierarchy by levels, such as computer policy and user policy.

public static PermissionSet ResolvePolicy(Evidence evidence)

Determines what permissions to grant to code based on the specified evidence.

public static PermissionSet ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, out PermissionSet denied)

Determines what permissions to grant to code based on the specified evidence and requests.

public static PermissionSet ResolvePolicy(Evidence[] evidences)

Determines what permissions to grant to code based on the specified evidence.

public static IEnumerator ResolvePolicyGroups(Evidence evidence)

Gets a collection of code groups matching the specified evidence.

public static PermissionSet ResolveSystemPolicy(Evidence evidence)

Determines which permissions to grant to code based on the specified evidence, excluding the policy for the AppDomain level.

public static void SavePolicy()

Saves the modified security policy state.

public static void SavePolicyLevel(PolicyLevel level)

Saves a modified security policy level loaded with LoadPolicyLevelFromFile.