Oracle 5.0 Reference Manual page 1925

Table of Contents

Advertisement

/// <summary>
/// Gets the password to send to the server in the authentication phase. This
can can be an string or a
/// </summary>
/// <returns>An object, can be byte[], string or null, with the password.
</returns>
/// <remarks>Default implementation returns null.</remarks>
public virtual object GetPassword()
/// <summary>
/// The authentication data passed when creating the plugin.
/// For example in mysql_native_password this is the seed to encrypt the
password.
/// </summary>
protected byte[] AuthData;
Sample Authentication Plugin
Here is an example showing how to create the authentication plugin, then enable it by means of a
configuration file. Follow these steps:
1. Create a console app, adding a reference to MySql.Data.dll.
2. Design the main program as follows:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
namespace AuthPluginTest
{
class Program
{
static void Main(string[] args)
{
// Customize the connection string as necessary.
MySqlConnection con = new MySqlConnection("server=localhost;
database=test; user id=myuser; password=mypass");
con.Open();
con.Close();
}
}
}
3. Create your plugin class. In this example, we add an "alternative" implementation of the Native
password plugin by just using the same code from the original plugin. We name our class
MySqlNativePasswordPlugin2:
using System.IO;
using System;
using System.Text;
using System.Security.Cryptography;
using MySql.Data.MySqlClient.Authentication;
using System.Diagnostics;
namespace AuthPluginTest
{
public class MySqlNativePasswordPlugin2 : MySqlAuthenticationPlugin
{
public override string PluginName
{
get { return "mysql_native_password"; }
}
public override object GetPassword()
{
Connector/Net Programming
1905

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents