Ejemplo n.º 1
0
 NetworkCredential Preprocessing.ICredentialsCache.QueryCredentials(Uri uri, string authType)
 {
     lock (credentialCacheLock)
     {
         if (credentialCache == null)
         {
             credentialCache = new NetworkCredentialsStorage(credentialsCacheStorage, new Persistence.SystemDataProtection());
         }
         var cred = credentialCache.GetCredential(uri);
         if (cred != null)
         {
             return(cred);
         }
         var ret = uiInvokeSynchronization.Invoke <NetworkCredential>(() =>
                                                                      CredUIUtils.ShowCredentialsDialog(appWindow.Handle,
                                                                                                        NetworkCredentialsStorage.GetRelevantPart(uri).ToString(),
                                                                                                        authType == "protected-archive")).Result;
         if (ret == null)
         {
             return(null);
         }
         credentialCache.Add(uri, ret);
         credentialCache.StoreSecurely();
         return(ret);
     }
 }
Ejemplo n.º 2
0
 NetworkCredential Preprocessing.ICredentialsCache.QueryCredentials(Uri uri, string authType)
 {
     lock (credentialCacheLock)
     {
         if (credentialCache == null)
         {
             credentialCache = new NetworkCredentialsStorage(credentialsCacheStorage);
         }
         var cred = credentialCache.GetCredential(uri);
         if (cred != null)
         {
             return(cred);
         }
         var ret = uiInvokeSynchronization.Invoke <NetworkCredential>(() =>
                                                                      CredUIUtils.ShowCredentialsDialog(appWindow.Handle, NetworkCredentialsStorage.StripToPrefix(uri).ToString())).Result;
         if (ret == null)
         {
             return(null);
         }
         credentialCache.Add(uri, ret);
         credentialCache.StoreSecurely();
         return(ret);
     }
 }