X509ClientCertificateAuthentication.MapClientCertificateToWindowsAccount Egenskap

Definition

Hämtar eller anger ett värde som anger om certifikatet är mappat till Windows konton.

public:
 property bool MapClientCertificateToWindowsAccount { bool get(); void set(bool value); };
public bool MapClientCertificateToWindowsAccount { get; set; }
member this.MapClientCertificateToWindowsAccount : bool with get, set
Public Property MapClientCertificateToWindowsAccount As Boolean

Egenskapsvärde

true om certifikatet har mappats till Windows konton, annars false. Standardvärdet är false.

Undantag

set när autentiseringsuppgifterna är skrivskyddade.

Exempel

Följande kod visar hur du anger den här egenskapen.

// Create a service host.
Uri httpUri = new Uri("http://localhost/Calculator");
ServiceHost sh = new ServiceHost(typeof(Calculator), httpUri);

// Create a binding that uses Windows security.
WSHttpBinding b = new WSHttpBinding(SecurityMode.Message);
b.Security.Message.ClientCredentialType = MessageCredentialType.Windows;

// Get a reference to the authentication object.
X509ClientCertificateAuthentication myAuthProperties =
    sh.Credentials.ClientCertificate.Authentication;
// Configure IncludeWindowsGroups.
myAuthProperties.IncludeWindowsGroups = true;
' Create a service host.
Dim httpUri As New Uri("http://localhost/Calculator")
Dim sh As New ServiceHost(GetType(Calculator), httpUri)

' Create a binding that uses Windows security.
Dim b As New WSHttpBinding(SecurityMode.Message)
b.Security.Message.ClientCredentialType = MessageCredentialType.Windows

' Get a reference to the authentication object.
Dim myAuthProperties As X509ClientCertificateAuthentication = _
sh.Credentials.ClientCertificate.Authentication
' Configure IncludeWindowsGroups.
myAuthProperties.IncludeWindowsGroups = True

Egenskapen kan också anges i en konfigurationsfil.

<serviceCredentials>
  <clientCertificate>
     <authentication mapClientCertificateToWindowsAccount='true'/>
  </clientCertificate>
</serviceCredentials>

Kommentarer

När du använder certifikatklientens autentiseringstyp för bindningar mappas inte certifikatet till Windows konton. Du kan åsidosätta det här beteendet med hjälp av den här egenskapen. När den här egenskapen är inställd på true gör det att identiteten från klientcertifikatet mappas till ett Windows konto.

Gäller för