Skip to content

Commit

Permalink
Skip EnsureHasCredential for ActiveDirectoryInteractive (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredmoo authored Jun 11, 2019
1 parent 6fd726f commit 9b8e406
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal static class ShardMapUtils
{
/// <summary>
/// SqlConnectionStringBuilder property that allows one
/// to specify the number of reconnect attempts on connection failure
/// to specify the number of reconnect attempts on connection failure
/// </summary>
internal static readonly string ConnectRetryCount = "ConnectRetryCount";

Expand All @@ -28,11 +28,18 @@ internal static class ShardMapUtils

/// <summary>
/// String representation of SqlAuthenticationMethod.ActiveDirectoryIntegrated
/// SqlAuthenticationMethod.ActiveDirectoryIntegrated.ToString() cannot be used
/// SqlAuthenticationMethod.ActiveDirectoryIntegrated.ToString() cannot be used
/// because it may not be available in the .NET framework version that we are running in
/// </summary>
internal static readonly string ActiveDirectoryIntegratedStr = "ActiveDirectoryIntegrated";

/// <summary>
/// String representation of SqlAuthenticationMethod.ActiveDirectoryInteractive
/// SqlAuthenticationMethod.ActiveDirectoryInteractive.ToString() cannot be used
/// because it may not be available in the .NET framework version that we are running in
/// </summary>
internal static readonly string ActiveDirectoryInteractiveStr = "ActiveDirectoryInteractive";

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
static ShardMapUtils()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,14 @@ internal static void EnsureCredentials(
}

// Check for active directory integrated authentication (if supported)
if (connectionString.ContainsKey(ShardMapUtils.Authentication) &&
connectionString[ShardMapUtils.Authentication].ToString().Equals(ShardMapUtils.ActiveDirectoryIntegratedStr))
if (connectionString.ContainsKey(ShardMapUtils.Authentication))
{
return;
string authentication = connectionString[ShardMapUtils.Authentication].ToString();
if (authentication.Equals(ShardMapUtils.ActiveDirectoryIntegratedStr, StringComparison.OrdinalIgnoreCase)
|| authentication.Equals(ShardMapUtils.ActiveDirectoryInteractiveStr, StringComparison.OrdinalIgnoreCase))
{
return;
}
}

// If secure credential not specified, verify that user/pwd are in the connection string. If secure credential
Expand Down

0 comments on commit 9b8e406

Please sign in to comment.