private KeychainAdapter AddCredential(UriString host) { var keychainAdapter = GetKeychainAdapter(host); if (string.IsNullOrEmpty(keychainAdapter.Credential.Token)) { throw new InvalidOperationException("Anonymous credentials cannot be stored"); } // saves credential in git credential manager (host, username, token) credentialManager.Delete(host); credentialManager.Save(keychainAdapter.Credential); return(keychainAdapter); }
private async Task <KeychainAdapter> AddCredential(UriString host) { var keychainAdapter = GetKeychainAdapter(host); if (keychainAdapter.OctokitCredentials == Credentials.Anonymous) { throw new InvalidOperationException("Anonymous credentials cannot be stored"); } // saves credential in git credential manager (host, username, token) await credentialManager.Delete(host); await credentialManager.Save(keychainAdapter.Credential); return(keychainAdapter); }
public async Task Clear(UriString host, bool deleteFromCredentialManager) { logger.Trace("Clear Host:{0}", host); // delete connection in the connection list connectionCache.Remove(host); //clear octokit credentials FindOrCreateAdapter(host).Clear(); WriteCacheToDisk(); if (deleteFromCredentialManager) { await credentialManager.Delete(host); } }