public static NetworkCredential End(IAsyncResult result, out TokenImpersonationLevel impersonationLevel, out bool allowNtlm)
 {
     TransportSecurityHelpers.GetSspiCredentialAsyncResult result2 = AsyncResult.End <TransportSecurityHelpers.GetSspiCredentialAsyncResult>(result);
     impersonationLevel = result2.impersonationLevel;
     allowNtlm          = result2.allowNtlm;
     return(result2.credential);
 }
 private static void OnGetToken(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         TransportSecurityHelpers.GetSspiCredentialAsyncResult asyncState = (TransportSecurityHelpers.GetSspiCredentialAsyncResult)result.AsyncState;
         Exception exception = null;
         try
         {
             asyncState.CompleteGetToken(result);
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             exception = exception2;
         }
         asyncState.Complete(false, exception);
     }
 }