Skip to content

Introduce support for AAD Device Code Flow authentication#597

Merged
cheenamalhotra merged 17 commits into
dotnet:masterfrom
cheenamalhotra:DeviceCodeFlow
Jul 27, 2020
Merged

Introduce support for AAD Device Code Flow authentication#597
cheenamalhotra merged 17 commits into
dotnet:masterfrom
cheenamalhotra:DeviceCodeFlow

Conversation

@cheenamalhotra

@cheenamalhotra cheenamalhotra commented Jun 10, 2020

Copy link
Copy Markdown
Member

This PR adds support for "Device Code Flow" authentication mode with MSAL.NET.
Reference documentation: OAuth2.0 Device Authorization Grant flow

Example of Connection string:

Server=<server>.database.windows.net; Authentication=Active Directory Device Code Flow; Database=Northwind;

Also enables customization of Device Code Flow callback with below API:
ActiveDirectoryAuthenticationProvider.SetDeviceCodeFlowCallback(Func<DeviceCodeResult, Task> deviceCodeFlowCallbackMethod)

Edit:

Added new APIs as under to enable customizations for "Active Directory Interactive" authentication experience:

  • ActiveDirectoryAuthenticationProvider.SetIWin32WindowFunc(Func<IWin32Window> iWin32WindowFunc)
    -- Applies to .NET Framework only
  • ActiveDirectoryAuthenticationProvider.SetParentActivityOrWindowFunc(Func<object> parentActivityOrWindowFunc)
    -- Applies to .NET Standard only
  • ActiveDirectoryAuthenticationProvider.SetCustomWebUi(ICustomWebUi customWebUi)
    -- Applies to .NET Framework, .NET Core and .NET Standard

Comment thread doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationMethod.xml Outdated
Comment thread doc/samples/CustomDeviceCodeFlowAzureAuthenticationProvider.cs Outdated
Comment thread doc/samples/CustomDeviceCodeFlowAzureAuthenticationProvider.cs Outdated
Comment thread doc/samples/CustomDeviceCodeFlowAzureAuthenticationProvider.cs
Comment thread doc/samples/CustomDeviceCodeFlowAzureAuthenticationProvider.cs Outdated
Comment thread doc/samples/CustomDeviceCodeFlowAzureAuthenticationProvider.cs Outdated
Co-authored-by: David Engel <dengel@magnitude.com>
Comment thread doc/samples/CustomDeviceCodeFlowAzureAuthenticationProvider.cs
Comment thread src/Microsoft.Data.SqlClient/netcore/src/Resources/SR.Designer.cs
Comment thread src/Microsoft.Data.SqlClient/netcore/src/Resources/SR.Designer.cs
Comment thread src/Microsoft.Data.SqlClient/netcore/src/Resources/SR.Designer.cs
Comment thread src/Microsoft.Data.SqlClient/tests/FunctionalTests/AADTests.cs Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml Outdated
Comment thread src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs Outdated
cheenamalhotra and others added 2 commits July 20, 2020 13:09
Comment thread doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml Outdated
Co-authored-by: David Engel <dengel@magnitude.com>
Comment thread doc/samples/AADAuthenticationCustomDeviceFlowCallback.cs Outdated
Comment thread doc/samples/AADAuthenticationCustomDeviceFlowCallback.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Public API 🆕 Issues/PRs that introduce new APIs to the driver.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants