Sprache

ActiveDirectoryAuthenticationProvider Konstruktoren

Definition

Überlädt

Name Beschreibung
ActiveDirectoryAuthenticationProvider()

Initialisiert die ActiveDirectoryAuthenticationProvider-Klasse

ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions)

Initialisiert die ActiveDirectoryAuthenticationProvider Klasse aus einer ActiveDirectoryAuthenticationProviderOptions Tasche. Dies ist der empfohlene Konstruktor für neuen Code, da neue Optionen hinzugefügt ActiveDirectoryAuthenticationProviderOptions werden können, ohne unterbrechungslose Änderungen für Aufrufer zu erzwingen.

ActiveDirectoryAuthenticationProvider(String)

Initialisiert die ActiveDirectoryAuthenticationProvider Klasse mit der bereitgestellten Anwendungsclient-ID.

ActiveDirectoryAuthenticationProvider(Func<DeviceCodeResult,Task>, String)

Initialisiert die ActiveDirectoryAuthenticationProvider Klasse mit der bereitgestellten Rückrufmethode für den Gerätecodefluss und der Anwendungsclient-ID.

ActiveDirectoryAuthenticationProvider()

Quelle:
ActiveDirectoryAuthenticationProvider.cs
Quelle:
ActiveDirectoryAuthenticationProvider.cs
Quelle:
ActiveDirectoryAuthenticationProvider.cs

Initialisiert die ActiveDirectoryAuthenticationProvider-Klasse

public:
 ActiveDirectoryAuthenticationProvider();
public ActiveDirectoryAuthenticationProvider();
Public Sub New ()

Hinweise

Neuer Code sollte die ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions) Überladung bevorzugen, um das Hinzufügen weiterer Konstruktorüberladungen zu vermeiden, da neue Optionen eingeführt werden.

Gilt für:

ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions)

Initialisiert die ActiveDirectoryAuthenticationProvider Klasse aus einer ActiveDirectoryAuthenticationProviderOptions Tasche. Dies ist der empfohlene Konstruktor für neuen Code, da neue Optionen hinzugefügt ActiveDirectoryAuthenticationProviderOptions werden können, ohne unterbrechungslose Änderungen für Aufrufer zu erzwingen.

public:
 ActiveDirectoryAuthenticationProvider(Microsoft::Data::SqlClient::ActiveDirectoryAuthenticationProviderOptions ^ options);
public ActiveDirectoryAuthenticationProvider(Microsoft.Data.SqlClient.ActiveDirectoryAuthenticationProviderOptions options);
new Microsoft.Data.SqlClient.ActiveDirectoryAuthenticationProvider : Microsoft.Data.SqlClient.ActiveDirectoryAuthenticationProviderOptions -> Microsoft.Data.SqlClient.ActiveDirectoryAuthenticationProvider
Public Sub New (options As ActiveDirectoryAuthenticationProviderOptions)

Parameter

options
ActiveDirectoryAuthenticationProviderOptions

Eine ActiveDirectoryAuthenticationProviderOptions Instanz, deren Eigenschaften den Anbieter initialisieren. Dieser Wert darf nicht null sein.

Ausnahmen

Wird ausgelöst, wenn options ist null.

Gilt für:

ActiveDirectoryAuthenticationProvider(String)

Quelle:
ActiveDirectoryAuthenticationProvider.cs
Quelle:
ActiveDirectoryAuthenticationProvider.cs
Quelle:
ActiveDirectoryAuthenticationProvider.cs

Initialisiert die ActiveDirectoryAuthenticationProvider Klasse mit der bereitgestellten Anwendungsclient-ID.

public:
 ActiveDirectoryAuthenticationProvider(System::String ^ applicationClientId);
public ActiveDirectoryAuthenticationProvider(string applicationClientId);
new Microsoft.Data.SqlClient.ActiveDirectoryAuthenticationProvider : string -> Microsoft.Data.SqlClient.ActiveDirectoryAuthenticationProvider
Public Sub New (applicationClientId As String)

Parameter

applicationClientId
String

Clientanwendungs-ID, die zum Abrufen eines Zugriffstokens für die Verbundauthentifizierung verwendet werden soll. Der Treiber verwendet standardmäßig eine eigene Anwendungsclient-ID.

Beispiele

Im folgenden Beispiel wird die Bereitstellung einer benutzerdefinierten Anwendungsclient-ID für sqlClient für die Authentifizierungsmethode "Active Directory Interactive" veranschaulicht:

using System;
using Microsoft.Data.SqlClient;

namespace CustomAuthenticationProviderExamples
{
  public class Program
  {
    public static void Main()
    {
      // Supported for all authentication modes supported by ActiveDirectoryAuthenticationProvider
      ActiveDirectoryAuthenticationProvider provider = new ActiveDirectoryAuthenticationProvider("<application_client_id>");
      if (provider.IsSupported(SqlAuthenticationMethod.ActiveDirectoryInteractive))
      {
        SqlAuthenticationProvider.SetProvider(SqlAuthenticationMethod.ActiveDirectoryInteractive, provider);
      }

      using (SqlConnection sqlConnection = new SqlConnection("Server=<myserver>.database.windows.net;Authentication=Active Directory Interactive;Database=>db<;"))
      {
        sqlConnection.Open();
        Console.WriteLine("Connected successfully!");
      }
    }
  }
}

Hinweise

Neuer Code sollte die ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions) Überladung bevorzugen, um das Hinzufügen weiterer Konstruktorüberladungen zu vermeiden, da neue Optionen eingeführt werden.

Gilt für:

ActiveDirectoryAuthenticationProvider(Func<DeviceCodeResult,Task>, String)

Quelle:
ActiveDirectoryAuthenticationProvider.cs
Quelle:
ActiveDirectoryAuthenticationProvider.cs
Quelle:
ActiveDirectoryAuthenticationProvider.cs

Initialisiert die ActiveDirectoryAuthenticationProvider Klasse mit der bereitgestellten Rückrufmethode für den Gerätecodefluss und der Anwendungsclient-ID.

public ActiveDirectoryAuthenticationProvider(Func<Microsoft.Identity.Client.DeviceCodeResult,System.Threading.Tasks.Task> deviceCodeFlowCallbackMethod, string applicationClientId = default);
public ActiveDirectoryAuthenticationProvider(Func<Microsoft.Identity.Client.DeviceCodeResult,System.Threading.Tasks.Task> deviceCodeFlowCallbackMethod, string? applicationClientId = default);
new Microsoft.Data.SqlClient.ActiveDirectoryAuthenticationProvider : Func<Microsoft.Identity.Client.DeviceCodeResult, System.Threading.Tasks.Task> * string -> Microsoft.Data.SqlClient.ActiveDirectoryAuthenticationProvider
Public Sub New (deviceCodeFlowCallbackMethod As Func(Of DeviceCodeResult, Task), Optional applicationClientId As String = Nothing)

Parameter

deviceCodeFlowCallbackMethod
Func<DeviceCodeResult,Task>

Die Rückrufmethode, die mit der Authentifizierung "Active Directory Gerätecodefluss" verwendet werden soll.

applicationClientId
String

(Optional) Clientanwendungs-ID, die zum Abrufen eines Zugriffstokens für die Verbundauthentifizierung verwendet werden soll. Der Treiber verwendet standardmäßig eine eigene Anwendungsclient-ID.

Hinweise

Neuer Code sollte die ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions) Überladung bevorzugen, um das Hinzufügen weiterer Konstruktorüberladungen zu vermeiden, da neue Optionen eingeführt werden.

Gilt für: