Skip to content

Commit

Permalink
Fix for .NET Standard + test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cheenamalhotra committed Sep 22, 2020
1 parent 569470a commit b7d18fb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Expand Up @@ -43,7 +43,6 @@ static SqlAuthenticationProviderManager()
Instance.SetProvider(SqlAuthenticationMethod.ActiveDirectoryDeviceCodeFlow, activeDirectoryAuthProvider);
Instance.SetProvider(SqlAuthenticationMethod.ActiveDirectoryManagedIdentity, azureManagedIdentityAuthenticationProvider);
Instance.SetProvider(SqlAuthenticationMethod.ActiveDirectoryMSI, azureManagedIdentityAuthenticationProvider);

}

/// <summary>
Expand Down
Expand Up @@ -9,13 +9,16 @@ internal partial class SqlAuthenticationProviderManager
static SqlAuthenticationProviderManager()
{
var activeDirectoryAuthProvider = new ActiveDirectoryAuthenticationProvider();
var azureManagedIdentityAuthenticationProvider = new AzureManagedIdentityAuthenticationProvider();

Instance = new SqlAuthenticationProviderManager();
Instance.SetProvider(SqlAuthenticationMethod.ActiveDirectoryPassword, activeDirectoryAuthProvider);
Instance.SetProvider(SqlAuthenticationMethod.ActiveDirectoryIntegrated, activeDirectoryAuthProvider);
Instance.SetProvider(SqlAuthenticationMethod.ActiveDirectoryInteractive, activeDirectoryAuthProvider);
Instance.SetProvider(SqlAuthenticationMethod.ActiveDirectoryServicePrincipal, activeDirectoryAuthProvider);
Instance.SetProvider(SqlAuthenticationMethod.ActiveDirectoryDeviceCodeFlow, activeDirectoryAuthProvider);
Instance.SetProvider(SqlAuthenticationMethod.ActiveDirectoryManagedIdentity, activeDirectoryAuthProvider);
Instance.SetProvider(SqlAuthenticationMethod.ActiveDirectoryManagedIdentity, azureManagedIdentityAuthenticationProvider);
Instance.SetProvider(SqlAuthenticationMethod.ActiveDirectoryMSI, azureManagedIdentityAuthenticationProvider);
}
}
}
Expand Up @@ -25,6 +25,7 @@ private static void ConnectAndDisconnect(string connectionString, SqlCredential
}
}

private static bool AreConnStringsSetup() => DataTestUtility.AreConnStringsSetup();
private static bool IsAzure() => !DataTestUtility.IsNotAzureServer();
private static bool IsAccessTokenSetup() => DataTestUtility.IsAccessTokenSetup();
private static bool IsAADConnStringsSetup() => DataTestUtility.IsAADPasswordConnStrSetup();
Expand Down Expand Up @@ -518,7 +519,7 @@ public static void AccessToken_UserManagedIdentityTest()
}
}

[ConditionalFact(nameof(DataTestUtility.AreConnStringsSetup), nameof(IsAzure))]
[ConditionalFact(nameof(AreConnStringsSetup), nameof(IsAzure))]
public static void Azure_SystemManagedIdentityTest()
{
string[] removeKeys = { "Authentication", "User ID", "Password", "UID", "PWD", "Trusted_Connection", "Integrated Security" };
Expand All @@ -533,7 +534,7 @@ public static void Azure_SystemManagedIdentityTest()
}
}

[ConditionalFact(nameof(DataTestUtility.AreConnStringsSetup), nameof(IsAzure))]
[ConditionalFact(nameof(AreConnStringsSetup), nameof(IsAzure))]
public static void Azure_UserManagedIdentityTest()
{
string[] removeKeys = { "Authentication", "User ID", "Password", "UID", "PWD", "Trusted_Connection", "Integrated Security" };
Expand All @@ -548,7 +549,7 @@ public static void Azure_UserManagedIdentityTest()
}
}

[ConditionalFact(nameof(DataTestUtility.AreConnStringsSetup), nameof(IsAzure))]
[ConditionalFact(nameof(AreConnStringsSetup), nameof(IsAzure))]
public static void Azure_AccessToken_SystemManagedIdentityTest()
{
string[] removeKeys = { "Authentication", "User ID", "Password", "UID", "PWD", "Trusted_Connection", "Integrated Security" };
Expand All @@ -562,7 +563,7 @@ public static void Azure_AccessToken_SystemManagedIdentityTest()
}
}

[ConditionalFact(nameof(DataTestUtility.AreConnStringsSetup), nameof(IsAzure))]
[ConditionalFact(nameof(AreConnStringsSetup), nameof(IsAzure))]
public static void Azure_AccessToken_UserManagedIdentityTest()
{
string[] removeKeys = { "Authentication", "User ID", "Password", "UID", "PWD", "Trusted_Connection", "Integrated Security" };
Expand Down

0 comments on commit b7d18fb

Please sign in to comment.