Classe WindowsAuthentication

Fournit une implémentation de service d'authentification qui exécute l'authentification Windows à l'aide de DomainContext généré à partir d'un service de domaine qui implémente l'interface IAuthentication.

Espace de noms: System.ServiceModel.DomainServices.Client.ApplicationServices
Assembly : System.ServiceModel.DomainServices.Client.Web (dans system.servicemodel.domainservices.client.web.dll)

Utilisation

'Utilisation
Dim instance As WindowsAuthentication

Syntaxe

'Déclaration
Public Class WindowsAuthentication
    Inherits WebAuthenticationService
public class WindowsAuthentication : WebAuthenticationService
public ref class WindowsAuthentication : public WebAuthenticationService
public class WindowsAuthentication extends WebAuthenticationService
public class WindowsAuthentication extends WebAuthenticationService

Notes

Pour configurer votre application de manière à utiliser l'authentification Windows, vous devez définir des valeurs à la fois dans le projet serveur et dans le projet client. Vous utilisez la classe WindowsAuthentication lors de la définition de la valeur dans le projet client.

Dans le fichier Web.config du projet serveur, définissez le mode d'authentification sur “Windows”, comme indiqué dans l'exemple suivant.

<system.web>
  <authentication mode="Windows"></authentication>
</system.web>

Dans le constructeur de l'objet Application de l'application cliente, définissez la propriété Authentication de l'objet WebContext sur WindowsAuthentication, comme indiqué dans l'exemple suivant. Le constructeur se trouve généralement dans un fichier nommé App.xaml.cs ou App.xaml.vb.

Public Sub New()
    InitializeComponent()

    Dim webContext As New WebContext()
    'webContext.Authentication = New FormsAuthentication()
    webContext.Authentication = New WindowsAuthentication()
    Me.ApplicationLifetimeObjects.Add(webContext)
End Sub
public App()
{
    InitializeComponent();

    WebContext webContext = new WebContext();
    //webContext.Authentication = new FormsAuthentication();
    webContext.Authentication = new WindowsAuthentication();
    this.ApplicationLifetimeObjects.Add(webContext);
}

Hiérarchie d'héritage

System.Object
   System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationService
     System.ServiceModel.DomainServices.Client.ApplicationServices.WebAuthenticationService
      System.ServiceModel.DomainServices.Client.ApplicationServices.WindowsAuthentication

Sécurité des threads

Tous les membres publics statiques (Partagés dans Visual Basic) de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.

Plateformes

Plateformes de développement

Windows XP Édition familiale, Windows XP Professionnel, Windows Server 2003 , Windows Server 2008 et Windows 2000

Plateformes cibles

Change History

Voir aussi

Référence

Membres WindowsAuthentication
Espace de noms System.ServiceModel.DomainServices.Client.ApplicationServices