Språk

ActiveDirectoryAuthenticationProvider Class

Definition

This class implements SqlAuthenticationProvider and is used for active directory federated authentication mechanisms.

public ref class ActiveDirectoryAuthenticationProvider sealed : Microsoft::Data::SqlClient::SqlAuthenticationProvider
public sealed class ActiveDirectoryAuthenticationProvider : Microsoft.Data.SqlClient.SqlAuthenticationProvider
type ActiveDirectoryAuthenticationProvider = class
    inherit SqlAuthenticationProvider
Public NotInheritable Class ActiveDirectoryAuthenticationProvider
Inherits SqlAuthenticationProvider
Inheritance
ActiveDirectoryAuthenticationProvider

Remarks

Responsibilities of this part:

  • Resolve the parent window handle handed to MSAL's WAM broker (and to the embedded WebView on .NET Framework) via WithParentActivityOrWindow.
  • Honor the caller-supplied SetParentActivityOrWindowFunc callback when present, and fall back to the process console window (resolved via Win32 interop) otherwise.

Constructors

Name Description
ActiveDirectoryAuthenticationProvider()

Initializes the ActiveDirectoryAuthenticationProvider class.

ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions)

Initializes the ActiveDirectoryAuthenticationProvider class from a ActiveDirectoryAuthenticationProviderOptions bag. This is the recommended constructor for new code because new options can be added to ActiveDirectoryAuthenticationProviderOptions without forcing breaking changes on callers.

ActiveDirectoryAuthenticationProvider(Func<DeviceCodeResult,Task>, String)

Initializes the ActiveDirectoryAuthenticationProvider class with the provided device code flow callback method and application client id.

ActiveDirectoryAuthenticationProvider(String)

Initializes the ActiveDirectoryAuthenticationProvider class with the provided application client id.

Methods

Name Description
AcquireTokenAsync(SqlAuthenticationParameters)

Acquires a security token from the authority.

BeforeLoad(SqlAuthenticationMethod)

This method is called immediately before the provider is added to authentication provider registry.

BeforeUnload(SqlAuthenticationMethod)

This method is called immediately before the provider is removed from the authentication provider registry.

ClearUserTokenCache()

Clears cached user tokens from the token provider.

IsSupported(SqlAuthenticationMethod)

Indicates whether the specified authentication method is supported.

SetAcquireAuthorizationCodeAsyncCallback(Func<Uri,Uri,CancellationToken,Task<Uri>>)

Sets a callback method which is invoked with a custom Web UI instance that will let the user sign-in with Entra ID, present consent if needed, and get back the authorization code. Applicable when working with Active Directory Interactive authentication.

SetDeviceCodeFlowCallback(Func<DeviceCodeResult,Task>)

Sets the callback method, overriding the default implementation that processes the result for 'Active Directory Device Code Flow' authentication.

SetIWin32WindowFunc(Func<IWin32Window>)

Sets a reference to the current IWin32Window that triggers the browser to be shown. Used to center the browser pop-up onto this window.

SetParentActivityOrWindowFunc(Func<Object>)

Sets a function to return the parent window handle to be used for WAM (Windows Account Manager) broker authentication prompts.

Applies to