Bahasa

ActiveDirectoryAuthenticationProvider Konstruktor

Definisi

Overload

Nama Deskripsi
ActiveDirectoryAuthenticationProvider()

Menginisialisasi ActiveDirectoryAuthenticationProvider kelas.

ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions)

Menginisialisasi ActiveDirectoryAuthenticationProvider kelas dari ActiveDirectoryAuthenticationProviderOptions tas. Ini adalah konstruktor yang direkomendasikan untuk kode baru karena opsi baru dapat ditambahkan ActiveDirectoryAuthenticationProviderOptions tanpa memaksa melanggar perubahan pada pemanggil.

ActiveDirectoryAuthenticationProvider(String)

Menginisialisasi ActiveDirectoryAuthenticationProvider kelas dengan id klien aplikasi yang disediakan.

ActiveDirectoryAuthenticationProvider(Func<DeviceCodeResult,Task>, String)

Menginisialisasi ActiveDirectoryAuthenticationProvider kelas dengan metode panggilan balik alur kode perangkat yang disediakan dan id klien aplikasi.

ActiveDirectoryAuthenticationProvider()

Sumber:
ActiveDirectoryAuthenticationProvider.cs
Sumber:
ActiveDirectoryAuthenticationProvider.cs
Sumber:
ActiveDirectoryAuthenticationProvider.cs

Menginisialisasi ActiveDirectoryAuthenticationProvider kelas.

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

Keterangan

Kode baru harus lebih memilih ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions) kelebihan beban untuk menghindari penambahan lebih banyak kelebihan konstruktor saat opsi baru diperkenalkan.

Berlaku untuk

ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions)

Menginisialisasi ActiveDirectoryAuthenticationProvider kelas dari ActiveDirectoryAuthenticationProviderOptions tas. Ini adalah konstruktor yang direkomendasikan untuk kode baru karena opsi baru dapat ditambahkan ActiveDirectoryAuthenticationProviderOptions tanpa memaksa melanggar perubahan pada pemanggil.

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

ActiveDirectoryAuthenticationProviderOptions Instans yang propertinya menginisialisasi penyedia. Tidak boleh null.

Pengecualian

Dilemparkan ketika options adalah null.

Berlaku untuk

ActiveDirectoryAuthenticationProvider(String)

Sumber:
ActiveDirectoryAuthenticationProvider.cs
Sumber:
ActiveDirectoryAuthenticationProvider.cs
Sumber:
ActiveDirectoryAuthenticationProvider.cs

Menginisialisasi ActiveDirectoryAuthenticationProvider kelas dengan id klien aplikasi yang disediakan.

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

Id Aplikasi Klien yang akan digunakan untuk memperoleh token akses untuk autentikasi gabungan. Driver menggunakan id klien aplikasinya sendiri secara default.

Contoh

Contoh berikut menunjukkan penyediaan id klien aplikasi yang ditentukan pengguna ke SqlClient untuk metode autentikasi "Direktori Aktif Interactive":

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!");
      }
    }
  }
}

Keterangan

Kode baru harus lebih memilih ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions) kelebihan beban untuk menghindari penambahan lebih banyak kelebihan konstruktor saat opsi baru diperkenalkan.

Berlaku untuk

ActiveDirectoryAuthenticationProvider(Func<DeviceCodeResult,Task>, String)

Sumber:
ActiveDirectoryAuthenticationProvider.cs
Sumber:
ActiveDirectoryAuthenticationProvider.cs
Sumber:
ActiveDirectoryAuthenticationProvider.cs

Menginisialisasi ActiveDirectoryAuthenticationProvider kelas dengan metode panggilan balik alur kode perangkat yang disediakan dan id klien aplikasi.

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>

Metode panggilan balik yang akan digunakan dengan autentikasi 'Direktori Aktif Alur Kode Perangkat'.

applicationClientId
String

(Opsional) Id Aplikasi Klien yang akan digunakan untuk memperoleh token akses untuk autentikasi gabungan. Driver menggunakan id klien aplikasinya sendiri secara default.

Keterangan

Kode baru harus lebih memilih ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions) kelebihan beban untuk menghindari penambahan lebih banyak kelebihan konstruktor saat opsi baru diperkenalkan.

Berlaku untuk