From eb1224365f8c2435069f7d02b765c418d416719f Mon Sep 17 00:00:00 2001 From: Serguei Michtchenko Date: Fri, 8 Oct 2021 15:12:48 -0700 Subject: [PATCH] Fixed ActiveDirectoryAuthenticationProvider constructors. --- .../ActiveDirectoryAuthenticationProvider.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs index 25f591f1c2..d15e241f75 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs @@ -33,10 +33,16 @@ private static ConcurrentDictionary - public ActiveDirectoryAuthenticationProvider() => new ActiveDirectoryAuthenticationProvider(DefaultDeviceFlowCallback); + public ActiveDirectoryAuthenticationProvider() + : this(DefaultDeviceFlowCallback) + { + } /// - public ActiveDirectoryAuthenticationProvider(string applicationClientId) => new ActiveDirectoryAuthenticationProvider(DefaultDeviceFlowCallback, applicationClientId); + public ActiveDirectoryAuthenticationProvider(string applicationClientId) + : this(DefaultDeviceFlowCallback, applicationClientId) + { + } /// public ActiveDirectoryAuthenticationProvider(Func deviceCodeFlowCallbackMethod, string applicationClientId = null) @@ -215,7 +221,7 @@ public override async Task AcquireTokenAsync(SqlAuthenti { // Fetch available accounts from 'app' instance System.Collections.Generic.IEnumerator accounts = (await app.GetAccountsAsync()).GetEnumerator(); - + IAccount account = default; if (accounts.MoveNext()) { @@ -343,7 +349,7 @@ private async Task AcquireTokenInteractiveDeviceFlowAsync( } } - private Task DefaultDeviceFlowCallback(DeviceCodeResult result) + private static Task DefaultDeviceFlowCallback(DeviceCodeResult result) { // This will print the message on the console which tells the user where to go sign-in using // a separate browser and the code to enter once they sign in.