Exemplo n.º 1
0
        /// <summary>
        /// Creates credential providers for each valid plugin (regardless if it supports authentication or not)
        /// </summary>
        /// <returns>credential providers</returns>
        public async Task <IEnumerable <ICredentialProvider> > BuildAllAsync()
        {
            var availablePlugins = await _pluginManager.FindAvailablePluginsAsync(CancellationToken.None);

            var plugins = new List <ICredentialProvider>();

            foreach (var pluginDiscoveryResult in availablePlugins)
            {
                _logger.LogDebug(string.Format(CultureInfo.CurrentCulture, Resources.SecurePluginNotice_UsingPluginAsProvider, pluginDiscoveryResult.PluginFile.Path));
                plugins.Add(new SecurePluginCredentialProvider(_pluginManager, pluginDiscoveryResult, _canShowDialog, _logger));
            }

            return(plugins);
        }
        /// <summary>
        /// Creates credential providers for each valid plugin (regardless if it supports authentication or not)
        /// </summary>
        /// <returns>credential providers</returns>
        public async Task <IEnumerable <ICredentialProvider> > BuildAll()
        {
            var availablePlugins = await _pluginManager.FindAvailablePluginsAsync(CancellationToken.None);

            var plugins = new List <ICredentialProvider>();

            foreach (var pluginDiscoveryResult in availablePlugins)
            {
                if (pluginDiscoveryResult.PluginFile.State == PluginFileState.Valid)
                {
                    _logger.LogDebug($"Will attempt to use {pluginDiscoveryResult.PluginFile.Path} as a credential provider");
                    plugins.Add(new SecurePluginCredentialProvider(_pluginManager, pluginDiscoveryResult, _logger));
                }
                else
                {
                    _logger.LogDebug($"Skipping {pluginDiscoveryResult.PluginFile.Path} as a credential provider.\n{pluginDiscoveryResult.Message}");
                }
            }

            return(plugins);
        }