BasicHttpMessageCredentialType 列舉

定義

BasicHttpBinding 中的安全性啟用時,用戶端可驗證的認證型別列舉。Enumerates credential types the client can authenticate with when security is enabled in the BasicHttpBinding binding.

public enum class BasicHttpMessageCredentialType
public enum BasicHttpMessageCredentialType
type BasicHttpMessageCredentialType = 
Public Enum BasicHttpMessageCredentialType
繼承
BasicHttpMessageCredentialType

欄位

Certificate 1

表示使用憑證來驗證用戶端。Indicates that a client be authenticated using a certificate.

UserName 0

表示使用使用者名稱認證來驗證用戶端。Indicates that the client be authenticated using a username credential.

範例

下列組態檔片段說明如何指定 BasicHttpMessageCredentialTypeThe following configuration file snippets illustrates how to specify BasicHttpMessageCredentialType:

重要區段為︰The important sections are:

繫結區段,我們在此指定安全性模式 (Message) 以及用來驗證用戶端的認證類型︰The bindings section where we specify the security mode (Message) and the type of credential that will be used to authenticate the client:

行為區段,我們在此指定服務驗證所用的憑證,以及驗證用戶端憑證的方法︰The behaviors section where we specify the certificate to use for service authentication and the method for validating the client certificate:

備註

如果設定了 Mode 來執行訊息層級的用戶端驗證,此列舉型別會控制用戶端認證型別。If Mode is configured to perform client authentication at the message level, this enumeration controls the client credential type. 使用者名稱與所用的 X.509 憑證都須透過一個實作了 IEndpointBehavior 擴充點的 SecurityCredentialsManager 執行個體提供;在通用預設案例中此為 ClientCredentialsBoth username and X.509 certificate to use must be provisioned through an IEndpointBehavior instance which implements the SecurityCredentialsManager extensibility point; in a common default case this is ClientCredentials.

憑證案例中的用戶端認證必須使用 ClientCertificate 類別的 ClientCredentials 屬性來指定。The client credential in the certificate case must be specified using the ClientCertificate property of the ClientCredentials class.

使用者名稱案例中的用戶端認證必須使用 UserName 類別的 ClientCredentials 屬性來指定。The client credential in the username case must be specified using the UserName property of the ClientCredentials class.

此外,當使用訊息安全性模式時,必須提供服務的憑證給用戶端。In addition, when message security mode is used, the client must be provisioned with the service's certificate. 此案例中的服務認證必須使用 ServiceCertificate 類別上的 ClientCredentials 屬性來指定。The service credential in this case must be specified using the ServiceCertificate property on the ClientCredentials class.

適用於