2009-07-03 8 views
1

J'ai besoin d'aide sur le WCF et l'autorisation. Actuellement, j'ai un client qui appelle en tant qu'objet remoting .NET hébergé dans un service Windows et qui appelle un service WCF (avec wshttpbinding). Le service WCF utilise l'authentification Windows avec une sécurité basée sur les messages.comment usurper l'identité côté client de l'appel wcf

Le service Windows s'exécute avec un compte spécial. Une fois qu'un appel client arrive à l'objet remoting .NET, thread.currentprincipal est défini sur le principal fourni par le client, de sorte que toutes les actions sont exécutées avec les informations d'identification du client. Aucun problème jusqu'à présent, voici maintenant mon problème actuel: Le service wcf doit être appelé avec les informations d'identification de l'utilisateur client. Afaik WCF utilise WindowsIdentity.GetCurrent pour créer les informations d'autorisation pour l'appel. Comme Thread.CurrentPrincipal contient l'identité que je veux utiliser pour l'appel, j'ai pensé (hread.CurrentPrincipal.Identity comme WindowsIdentity) .Impersonate() fait le travail.

Mais maintenant, je suis en train au lieu d'une exception de sécurité WCF cette exception: System.ComponentModel.Win32Exception: Aucune information d'identification sont disponibles dans le package de sécurité

Callstack: à System.IdentityModel.SspiWrapper.AcquireCredentialsHandle (paquet de cordes, l'intention CredentialUse, AuthIdentityEx & authdata) à System.ServiceModel.Security.SecurityUtils.GetCredentialsHandle (paquet String, NetworkCredential informations d'identification, Boolean IsServer, String [] additionalPackages) à System.ServiceModel.Security.SecurityUtils.GetCredentialsHandle (SecurityBindingElement SBE , ClientCredentials clientCredentials) à System.ServiceModel.Security.SecurityUtils.GetCredentialsHandle (SecurityBindingElement SBE, le contexte BindingContext) à System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.OnOpening() à System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpening() à System.ServiceModel. Channels.CommunicationObject.Open (timeout TimeSpan) à System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open (TimeSpan timeout) à System.ServiceModel.Security.SecurityUtils.OpenTokenProviderIfRequired (SecurityTokenProvider tokenProvider, délai d'TimeSpan) à System.ServiceModel.Security. SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen (TimeSpan timeout) à System.ServiceModel.Channels.CommunicationObject. Ouvrir (délai d'attente TimeSpan) à System.ServiceModel.Channels.ServiceChannel.OnOpen (Timeout TimeSpan) à System.ServiceModel.Channels.CommunicationObject.Open (Timeout TimeSpan) à System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel .Channels.ServiceChannel.ICallOnce.Call (canal ServiceChannel, délai d'TimeSpan) à System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce (TimeSpan timeout, cascade CallOnceManager) à System.ServiceModel.Channels.ServiceChannel.EnsureOpened (timeout TimeSpan) à System.ServiceModel.Channels.ServiceChannel.Call (Action de chaîne, Boolean oneway, opération ProxyOperationRuntime, Object [] ins, Object [] outs, TimeSpan timeout) à System.ServiceModel.Channels.ServiceChannel.Call (String action, Boolean Oneway, ProxyO Opération perationRuntime, Object [] ins, Object [] outs) à System.ServiceModel.Channels.ServiceChannelProxy.InvokeService (méthodeCheminMethodeAppel, opération ProxyOperationRuntime) à System.ServiceModel.Channels.ServiceChannelProxy.Invoke (message iMessage)

thx pour toute aide Martin

EDIT: Je fait une erreur qui conduit à cette exception, parce que j'oublié de créer le ChannelFactory après l'usurpation d'identité, mais maintenant je reçois une autre exception, où Je ne sais pas vraiment comment y faire face: System.IO.FileLoadException: Impossible de charger le fichier ou l'assembly 'System.IdentityModel.Selectors, Version = 3.0.0.0, Culture = neutre, PublicKeyToken = b77a5c561934e089' ou l'une de ses dépendances. Un niveau d'emprunt d'identité requis n'a pas été fourni ou le niveau d'emprunt d'identité fourni n'est pas valide. (Exception de HRESULT: 0x80070542)

Répondre