public void Dispose()
 {
     if (_asyncFlowControl != default)
     {
         _asyncFlowControl.Dispose();
     }
 }
Example #2
0
        internal static SecurityContext CaptureSecurityContextNoIdentityFlow()
        {
            SecurityContext securityContext;

            if (!SecurityContext.IsWindowsIdentityFlowSuppressed())
            {
                AsyncFlowControl asyncFlowControl = SecurityContext.SuppressFlowWindowsIdentity();
                try
                {
                    securityContext = SecurityContext.Capture();
                }
                finally
                {
                    asyncFlowControl.Dispose();
                }
                return(securityContext);
            }
            else
            {
                return(SecurityContext.Capture());
            }
        }