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 = uiInvoke.Invoke <NetworkCredential>(() => NetworkCredentialsDialogController.ShowSheet(parentWindow, NetworkCredentialsStorage.GetRelevantPart(uri).ToString(), authType == "protected-archive")).Result; if (ret == null) { return(null); } credentialCache.Add(uri, ret); credentialCache.StoreSecurely(); return(ret); } }
public static NetworkCredential ShowSheet(NSWindow inWindow, string site) { var dlg = new NetworkCredentialsDialogController(site); NSApplication.SharedApplication.BeginSheet(dlg.Window, inWindow); NSApplication.SharedApplication.RunModalForWindow(dlg.Window); if (!dlg.confirmed) { return(null); } return(new NetworkCredential(dlg.userNameTextField.StringValue, dlg.passwordTextField.StringValue)); }
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 = uiInvoke.Invoke <NetworkCredential>(() => NetworkCredentialsDialogController.ShowSheet(parentWindow, NetworkCredentialsStorage.StripToPrefix(uri).ToString())).Result; if (ret == null) { return(null); } credentialCache.Add(uri, ret); credentialCache.StoreSecurely(); return(ret); } }