ActiveDirectoryAuthenticationProvider Constructeurs
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Surcharges
| Nom | Description |
|---|---|
| ActiveDirectoryAuthenticationProvider() |
Initialise la classe ActiveDirectoryAuthenticationProvider. |
| ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions) |
Initialise la ActiveDirectoryAuthenticationProvider classe à partir d’un ActiveDirectoryAuthenticationProviderOptions sac. Il s’agit du constructeur recommandé pour le nouveau code, car de nouvelles options peuvent être ajoutées |
| ActiveDirectoryAuthenticationProvider(String) |
Initialise la ActiveDirectoryAuthenticationProvider classe avec l’ID client d’application fourni. |
| ActiveDirectoryAuthenticationProvider(Func<DeviceCodeResult,Task>, String) |
Initialise la classe avec la méthode de rappel de ActiveDirectoryAuthenticationProvider flux d’appareil fournie et l’ID client de l’application. |
ActiveDirectoryAuthenticationProvider()
Initialise la classe ActiveDirectoryAuthenticationProvider.
public:
ActiveDirectoryAuthenticationProvider();
public ActiveDirectoryAuthenticationProvider();
Public Sub New ()
Remarques
Le nouveau code doit préférer la ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions) surcharge pour éviter d’ajouter davantage de surcharges de constructeur à mesure que de nouvelles options sont introduites.
S’applique à
ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions)
Initialise la ActiveDirectoryAuthenticationProvider classe à partir d’un ActiveDirectoryAuthenticationProviderOptions sac. Il s’agit du constructeur recommandé pour le nouveau code, car de nouvelles options peuvent être ajoutées ActiveDirectoryAuthenticationProviderOptions sans forcer les modifications cassants sur les appelants.
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)
Paramètres
Instance ActiveDirectoryAuthenticationProviderOptions dont les propriétés initialisent le fournisseur. Ne doit pas être null.
Exceptions
Levée quand options a la valeur null.
S’applique à
ActiveDirectoryAuthenticationProvider(String)
Initialise la ActiveDirectoryAuthenticationProvider classe avec l’ID client d’application fourni.
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)
Paramètres
- applicationClientId
- String
ID d’application cliente à utiliser pour acquérir un jeton d’accès pour l’authentification fédérée. Le pilote utilise son propre ID client d’application par défaut.
Exemples
L’exemple suivant illustre la fourniture d’un ID client d’application défini par l’utilisateur à SqlClient pour la méthode d’authentification « Active Directory 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!");
}
}
}
}
Remarques
Le nouveau code doit préférer la ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions) surcharge pour éviter d’ajouter davantage de surcharges de constructeur à mesure que de nouvelles options sont introduites.
S’applique à
ActiveDirectoryAuthenticationProvider(Func<DeviceCodeResult,Task>, String)
Initialise la classe avec la méthode de rappel de ActiveDirectoryAuthenticationProvider flux d’appareil fournie et l’ID client de l’application.
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)
Paramètres
- deviceCodeFlowCallbackMethod
- Func<DeviceCodeResult,Task>
Méthode de rappel à utiliser avec l'authentification « Active Directory Device Code Flow ».
- applicationClientId
- String
(Facultatif) ID d’application cliente à utiliser pour acquérir un jeton d’accès pour l’authentification fédérée. Le pilote utilise son propre ID client d’application par défaut.
Remarques
Le nouveau code doit préférer la ActiveDirectoryAuthenticationProvider(ActiveDirectoryAuthenticationProviderOptions) surcharge pour éviter d’ajouter davantage de surcharges de constructeur à mesure que de nouvelles options sont introduites.