/// <summary>
        /// Obtains the plugin configuration for the OAuth 2.0 authentication process.
        /// </summary>
        /// <param name="pluginInfoConfiguration">The list of defined authentication plugins defined.</param>
        /// <param name="oAuth2Configuration">The configuration, if found, or null otherwise.</param>
        /// <returns>True if OAuth is found, false otherwise.</returns>
        public static bool TryGetOAuth2Configuration(this IEnumerable <PluginInfoConfiguration> pluginInfoConfiguration, out OAuth2Configuration oAuth2Configuration)
        {
            // Is OAuth 2.0 specified?
            oAuth2Configuration = pluginInfoConfiguration?
                                  .Where(pic => pic.Protocol == IEnumerablePluginInfoConfigurationExtensionMethods.OAuth2PluginConfigurationProtocol)?
                                  .Select(pic => OAuth2Configuration.ParseFrom(pic.Configuration, pic.VaultGuid))?
                                  .FirstOrDefault();

            // Did we get a value?
            return(oAuth2Configuration != null);
        }
示例#2
0
        /// <summary>
        /// Obtains the plugin configuration for the OAuth 2.0 authentication process.
        /// </summary>
        /// <param name="pluginInfoConfiguration">The list of defined authentication plugins defined.</param>
        /// <param name="oAuth2Configuration">The configuration, if found, or null otherwise.</param>
        /// <returns>True if OAuth is found, false otherwise.</returns>
        public static bool TryGetOAuth2Configuration(this IEnumerable <PluginInfoConfiguration> pluginInfoConfiguration, out OAuth2Configuration oAuth2Configuration)
        {
            // Sanity.
            if (null == pluginInfoConfiguration)
            {
                throw new ArgumentNullException(nameof(pluginInfoConfiguration));
            }

            // Is OAuth 2.0 specified?
            oAuth2Configuration = pluginInfoConfiguration
                                  .Where(pic => pic.Protocol == IEnumerablePluginInfoConfigurationExtensionMethods.OAuth2PluginConfigurationProtocol)
                                  .Select(pic => OAuth2Configuration.ParseFrom(pic.Configuration))
                                  .FirstOrDefault();

            // Did we get a value?
            return(oAuth2Configuration != null);
        }