예제 #1
0
        /// <summary>
        /// This is a factory method that is used only internally.  It creates an auth plugin based on the method type
        /// </summary>
        /// <param name="method"></param>
        /// <param name="flags"></param>
        /// <param name="settings"></param>
        /// <returns></returns>
        internal static MySqlAuthenticationPlugin GetPlugin(string method, NativeDriver driver, byte[] authData)
        {
            if (method == "mysql_old_password")
            {
                driver.Close(true);
                throw new MySqlException(MySqlResources.OldPasswordsNotSupported);
            }
            MySqlAuthenticationPlugin plugin = AuthenticationPluginManager.GetPlugin(method);

            if (plugin == null)
            {
                throw new MySqlException(String.Format(MySqlResources.UnknownAuthenticationMethod, method));
            }

            plugin.driver = driver;
            plugin.SetAuthData(authData);
            return(plugin);
        }