質問

I'm calling a WCF service from a Windows service, and I'd like to authenticate the client through the Windows user that the service is running as.

For various reasons (streaming/SSL, mainly) I have to use anonymous authentication for transport credentials. Is there any way to send my WindowsIdentity through the message, the same way you would normally send ClientCredentials.Username.Username or ClientCredentials.Username.Password?

BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential;
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;    
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;            
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;      

ServerContractClient serverConnection = new ServerContractClient(binding, new EndpointAddress(url));

string username = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
serverConnection.ClientCredentials = ???

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top