Skip to content

Commit d03089e

Browse files
committed
#7 - Rework platform abstractions for .netcore to allow windowsauth module
1 parent 470fa04 commit d03089e

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Source/MySql.Data/Authentication/AuthenticationManager.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,19 @@ static AuthenticationPluginManager()
3636
{
3737
plugins["mysql_native_password"] = new PluginInfo("MySql.Data.MySqlClient.Authentication.MySqlNativePasswordPlugin");
3838
plugins["sha256_password"] = new PluginInfo("MySql.Data.MySqlClient.Authentication.Sha256AuthenticationPlugin");
39-
#if !CF && !RT && !NETSTANDARD1_3
39+
#if !CF && !RT
4040
plugins["authentication_windows_client"] = new PluginInfo("MySql.Data.MySqlClient.Authentication.MySqlWindowsAuthenticationPlugin");
41+
#if !NETSTANDARD1_3
4142
if (MySqlConfiguration.Settings != null && MySqlConfiguration.Settings.AuthenticationPlugins != null)
4243
{
4344
foreach (AuthenticationPluginConfigurationElement e in MySqlConfiguration.Settings.AuthenticationPlugins)
4445
plugins[e.Name] = new PluginInfo(e.Type);
4546
}
4647
#endif
47-
}
48+
#endif
49+
}
4850

49-
public static MySqlAuthenticationPlugin GetPlugin(string method)
51+
public static MySqlAuthenticationPlugin GetPlugin(string method)
5052
{
5153
if (!plugins.ContainsKey(method))
5254
throw new MySqlException(String.Format(Resources.AuthenticationMethodNotSupported, method));

Source/MySql.Data/Authentication/WindowsAuthenticationPlugin.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@ internal class MySqlWindowsAuthenticationPlugin : MySqlAuthenticationPlugin
4747
protected override void CheckConstraints()
4848
{
4949
string platform = String.Empty;
50-
#if !RT && !NETSTANDARD1_3
51-
int p = (int)Environment.OSVersion.Platform;
52-
if ((p == 4) || (p == 128))
50+
#if !RT
51+
if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
5352
platform = "Unix";
54-
else if (Environment.OSVersion.Platform == PlatformID.MacOSX)
53+
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
5554
platform = "Mac OS/X";
5655

5756
if (!String.IsNullOrEmpty(platform))

0 commit comments

Comments
 (0)