/// <summary>
        /// Registers the specified authentication plugin. The name of this plugin must be unique.
        /// </summary>
        /// <param name="plugin">The authentication plugin.</param>
        public static void Register(IAuthenticationPlugin plugin)
        {
            if (plugin is null)
            {
                throw new ArgumentNullException(nameof(plugin));
            }
            if (string.IsNullOrEmpty(plugin.Name))
            {
                throw new ArgumentException("Invalid plugin name.", nameof(plugin));
            }

            lock (s_lock)
                s_plugins.Add(plugin.Name, plugin);
        }
示例#2
0
 internal static bool TryGetPlugin(string name, out IAuthenticationPlugin plugin)
 {
     lock (s_lock)
         return(s_plugins.TryGetValue(name, out plugin));
 }