語言

X509ClientCertificateAuthentication.IncludeWindowsGroups 屬性

定義

取得或設定一個值,指示 Windows 群組是否包含在授權上下文中。

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

屬性值

true若授權上下文包含 Windows 群組;否則,。 false 預設值為 true。

範例

以下程式碼說明如何設定這個屬性。

// Create a service host.
Uri httpUri = new Uri("http://localhost/Calculator");
ServiceHost sh = new ServiceHost(typeof(Calculator), httpUri);
// Create a binding that uses a certificate.
WSHttpBinding b = new WSHttpBinding(SecurityMode.Message);
b.Security.Message.ClientCredentialType =
    MessageCredentialType.Certificate;

// 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 a certificate.
Dim b As New WSHttpBinding(SecurityMode.Message)
b.Security.Message.ClientCredentialType = MessageCredentialType.Certificate


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

這個屬性也可以在設定檔中設定。

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

備註

此性質僅在該 MapClientCertificateToWindowsAccount 性質被設定為 true時有效。

僅在不需要建立使用者所屬群組清單時,將此屬性 false 設為——若應用程式與授權決策不需 Windows 群組,這可能會帶來效能提升。

適用於