<PackageReference Include="System.Security.Permissions" Version="11.0.0-preview.2.26159.112" />

System.Security.SecurityContext

public sealed class SecurityContext : IDisposable
Encapsulates and propagates all security-related data for execution contexts transferred across threads. This class cannot be inherited.
namespace System.Security { public sealed class SecurityContext : IDisposable { public static SecurityContext Capture(); public SecurityContext CreateCopy(); public void Dispose(); public static bool IsFlowSuppressed(); public static bool IsWindowsIdentityFlowSuppressed(); public static void RestoreFlow(); public static void Run(SecurityContext securityContext, ContextCallback callback, object state); public static AsyncFlowControl SuppressFlow(); public static AsyncFlowControl SuppressFlowWindowsIdentity(); } }