Skip to content

ActiveDirectoryAuthenticationProvider constructors implemented incorrectly #1327

@smichtch

Description

@smichtch

Describe the bug

public ActiveDirectoryAuthenticationProvider() and public ActiveDirectoryAuthenticationProvider(string applicationClientId) are not delegating initialization to public ActiveDirectoryAuthenticationProvider(Func<DeviceCodeResult, Task> deviceCodeFlowCallbackMethod, string applicationClientId).

Instead of this:

public ActiveDirectoryAuthenticationProvider() => new ActiveDirectoryAuthenticationProvider(DefaultDeviceFlowCallback);
public ActiveDirectoryAuthenticationProvider(string applicationClientId) => new ActiveDirectoryAuthenticationProvider(DefaultDeviceFlowCallback, applicationClientId);

it should be:

public ActiveDirectoryAuthenticationProvider() : this(DefaultDeviceFlowCallback) {}
public ActiveDirectoryAuthenticationProvider(string applicationClientId) : this(DefaultDeviceFlowCallback, applicationClientId) {}

To reproduce

var provider = new ActiveDirectoryAuthenticationProvider("<my app ID>");
SqlAuthenticationProvider.SetProvider(SqlAuthenticationMethod.ActiveDirectoryInteractive, provider);

provider still uses the default client app ID 2fd908ad-0664-4344-b9be-cd3e8b574c38 instead of <my app ID>.

Expected behavior

New ActiveDirectoryAuthenticationProvider instances should use the client app ID specified in the constructor argument.

Further technical details

Microsoft.Data.SqlClient version: 3.0.1
.NET target: net472, netcoreapp3.1, net5.0
SQL Server version: n/a
Operating system: Windows 10 Enterprise Build 19043

Additional context
None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions