public async Task StoreToken(AzureToken token) { string dir = Path.Combine(_root, "Subscriptions"); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } string path = Path.Combine(dir, token.SubscriptionId + ".dat"); string content = JsonFormat.Serialize(token); var protectedData = Convert.ToBase64String( ProtectedData.Protect( Encoding.UTF8.GetBytes(content), null, DataProtectionScope.CurrentUser)); using (var writer = new StreamWriter(path)) { await writer.WriteAsync(protectedData); } }
public async Task StoreToken(AzureToken token) { string dir = Path.Combine(_root, "Subscriptions"); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } string path = Path.Combine(dir, token.SubscriptionId + ".dat"); string content = JsonFormat.Serialize(token); var protectedData = Convert.ToBase64String( ProtectedData.Protect( Encoding.UTF8.GetBytes(content), null, DataProtectionScope.CurrentUser)); using (var writer = new StreamWriter(path)) { await writer.WriteAsync(protectedData); } }