Editare

Partajați prin


MessageCredentialType Enum

Definition

Enumerates the valid message credential types.

public enum class MessageCredentialType
public enum MessageCredentialType
type MessageCredentialType = 
Public Enum MessageCredentialType
Inheritance
MessageCredentialType

Fields

Name Value Description
None 0

Specifies anonymous authentication.

Windows 1

Specifies client authentication using Windows.

UserName 2

Specifies client authentication using UserName.

Certificate 3

Specifies client authentication using a certificate.

IssuedToken 4

Specifies client authentication using an issued token.

Examples

The following code shows how to access and set ClientCredentialType to a member of this enumeration.

ServiceHost myServiceHost = new ServiceHost(typeof(CalculatorService));
// Create a binding to use.
WSHttpBinding binding = new WSHttpBinding();
binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.ClientCredentialType =
    MessageCredentialType.Certificate;

// Set the client certificate.
myServiceHost.Credentials.ClientCertificate.SetCertificate(
    StoreLocation.CurrentUser,
    StoreName.My,
    X509FindType.FindBySubjectName,
    "client.com");
Dim myServiceHost As New ServiceHost(GetType(CalculatorService))
' Create a binding to use.
Dim binding As New WSHttpBinding()
binding.Security.Mode = SecurityMode.Message
binding.Security.Message.ClientCredentialType = _
MessageCredentialType.Certificate

' Set the client certificate.
myServiceHost.Credentials.ClientCertificate.SetCertificate( _
        StoreLocation.CurrentUser, _
        StoreName.My, _
        X509FindType.FindBySubjectName, _
        "client.com")

Remarks

This enumeration is used to specify the credential type required by a binding for authentication. It is used by all standard bindings except the BasicHttpBinding, which uses BasicHttpMessageCredentialType.

Applies to