BasicHttpMessageCredentialType BasicHttpMessageCredentialType BasicHttpMessageCredentialType BasicHttpMessageCredentialType Enum

定义

枚举在 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
继承
BasicHttpMessageCredentialTypeBasicHttpMessageCredentialTypeBasicHttpMessageCredentialTypeBasicHttpMessageCredentialType

字段

Certificate Certificate Certificate Certificate 1

指示使用证书对客户端进行身份验证。Indicates that a client be authenticated using a certificate.

UserName UserName UserName 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:

指定安全模式(消息)和将用于对客户端进行身份验证的凭据类型的绑定部分: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. 必须通过 IEndpointBehavior 实例同时提供要使用的用户名和 X.509 证书,该实例实现 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.

适用于