Skip to content

Commit

Permalink
Fixed ActiveDirectoryAuthenticationProvider constructors.
Browse files Browse the repository at this point in the history
  • Loading branch information
smichtch committed Oct 8, 2021
1 parent d9c2e7c commit dbf8f81
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@ private static ConcurrentDictionary<PublicClientAppKey, IPublicClientApplication
private readonly string _applicationClientId = ActiveDirectoryAuthentication.AdoClientId;

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml' path='docs/members[@name="ActiveDirectoryAuthenticationProvider"]/ctor/*'/>
public ActiveDirectoryAuthenticationProvider() => new ActiveDirectoryAuthenticationProvider(DefaultDeviceFlowCallback);
public ActiveDirectoryAuthenticationProvider()
: this(DefaultDeviceFlowCallback)
{
}

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml' path='docs/members[@name="ActiveDirectoryAuthenticationProvider"]/ctor2/*'/>
public ActiveDirectoryAuthenticationProvider(string applicationClientId) => new ActiveDirectoryAuthenticationProvider(DefaultDeviceFlowCallback, applicationClientId);
public ActiveDirectoryAuthenticationProvider(string applicationClientId)
: this(DefaultDeviceFlowCallback, applicationClientId)
{
}

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml' path='docs/members[@name="ActiveDirectoryAuthenticationProvider"]/ctor3/*'/>
public ActiveDirectoryAuthenticationProvider(Func<DeviceCodeResult, Task> deviceCodeFlowCallbackMethod, string applicationClientId = null)
Expand Down Expand Up @@ -215,7 +221,7 @@ public override async Task<SqlAuthenticationToken> AcquireTokenAsync(SqlAuthenti
{
// Fetch available accounts from 'app' instance
System.Collections.Generic.IEnumerator<IAccount> accounts = (await app.GetAccountsAsync()).GetEnumerator();

IAccount account = default;
if (accounts.MoveNext())
{
Expand Down Expand Up @@ -343,7 +349,7 @@ private async Task<AuthenticationResult> 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.
Expand Down

0 comments on commit dbf8f81

Please sign in to comment.