ActiveDirectoryAuthenticationProvider Konstruktor
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
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 |
| 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()
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
ActiveDirectoryAuthenticationProviderOptions Instans yang propertinya menginisialisasi penyedia. Tidak boleh null.
Pengecualian
Dilemparkan ketika options adalah null.
Berlaku untuk
ActiveDirectoryAuthenticationProvider(String)
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)
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.