IChannelCredentials Interface

Définition

Interface qui permet de définir certaines fonctionnalités de sécurité sur un proxy de service.

public interface class IChannelCredentials
[System.Runtime.InteropServices.Guid("181b448c-c17c-4b17-ac6d-06699b93198f")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIDispatch)]
public interface IChannelCredentials
[<System.Runtime.InteropServices.Guid("181b448c-c17c-4b17-ac6d-06699b93198f")>]
[<System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIDispatch)>]
type IChannelCredentials = interface
Public Interface IChannelCredentials
Attributs

Exemples

monString = "service:mexAddress=http://localhost:8000/ServiceModelSamples/Service?wsdl"  
    monString = monString + ", address=http://localhost:8000/ServiceModelSamples/Service"  
    monString = monString + ", binding=BasicHttpBinding_ICalculator, bindingNamespace=http://Microsoft.ServiceModel.Samples"  
    monString = monString + ", contract=ICalculator, contractNamespace=http://Microsoft.ServiceModel.Samples"  

    Set monikerProxy = GetObject(monString)  

    'Set the Service Certificate.  
    monikerProxy.ChannelCredentials.SetServiceCertificateAuthentication "CurrentUser", "NoCheck", "PeerOrChainTrust"  
    monikerProxy.ChannelCredentials.SetDefaultServiceCertificateFromStore "CurrentUser", "TrustedPeople", "FindBySubjectName", "localhost"  

    'Set the Client Certificate.  
    monikerProxy.ChannelCredentials.SetClientCertificateFromStoreByName "CN=client.com", "CurrentUser", "My"  
    MsgBox monikerProxy.Add(3, 4)  

Remarques

Les clients non managés utilisent le moniker « service » pour accéder aux services Windows Communication Foundation (WCF). Ces clients sont soumis au modèle de sécurité WCF plutôt qu’au modèle de sécurité COM. L’interface IChannelCredentials est fournie pour spécifier les informations d’identification du canal. Cela est nécessaire, car le moniker COM ne peut pas accéder au modèle objet de sécurité WCF managé.

Il n’est pas légal d’appeler des méthodes sur l’interface IChannelCredentials après la création du canal. Cela est dû au fait que Windows Communication Foundation (WCF) ne prend pas en charge la modification des paramètres de sécurité sur un canal déjà ouvert. Lorsque le client moniker de service obtient un proxy, le canal n’est pas encore créé. Par conséquent, le client doit appeler IChannelCredentials des méthodes avant d’appeler la méthode de service. Si le client appelle une IChannelCredentials méthode après l’appel de la méthode de service, l’exception RPC_E_TOO_LATE est levée.

Méthodes

Nom Description
SetClientCertificateFromFile(String, String, String)

Récupère un certificat à partir d’un fichier et l’ajoute aux informations d’identification du client.

SetClientCertificateFromStore(String, String, String, Object)

Récupère un certificat à partir d’un magasin de certificats et l’ajoute aux informations d’identification du client.

SetClientCertificateFromStoreByName(String, String, String)

Récupère un certificat d’un magasin de certificats par nom et l’ajoute aux informations d’identification du client.

SetDefaultServiceCertificateFromFile(String, String, String)

Récupère un certificat à partir d’un fichier et l’ajoute aux informations d’identification du service comme certificat par défaut.

SetDefaultServiceCertificateFromStore(String, String, String, Object)

Récupère un certificat à partir d’un magasin de certificats et l’ajoute aux informations d’identification du service comme certificat par défaut.

SetDefaultServiceCertificateFromStoreByName(String, String, String)

Récupère un certificat à partir d’un magasin de certificats par nom et l’ajoute aux informations d’identification du service comme certificat par défaut.

SetIssuedToken(String, String, String)

Définit les paramètres du jeton émis.

SetServiceCertificateAuthentication(String, String, String)

Définit les paramètres d’authentification des certificats de service.

SetUserNameCredential(String, String)

Définit les informations d’identification du nom d’utilisateur.

SetWindowsCredential(String, String, String, Int32, Boolean)

Définit les informations d’identification Windows.

S’applique à