[英]WCF client with Client Certificate and Basic Authentication
I need to access web services of one of our partners. 我需要访问我们合作伙伴的网络服务。 Their services are secured with both a Client Certificate and Basic Authentication.
他们的服务使用客户端证书和基本身份验证进行保护。 I'm using WCF with BasicHttpBinding.
我正在使用WCF和BasicHttpBinding。
I am able to hook up the cert using Transport level security. 我能够使用传输级安全性来连接证书。 I know the cert is working because I'm no longer getting a 403 error, but I am getting a 401 because I can't pass the credentials along with the transport.
我知道证书正在运行,因为我不再收到403错误,但我得到的是401,因为我无法将凭据与传输一起传递。 From what I can see, I can only have one type of transport security scheme.
从我所看到的,我只能有一种类型的传输安全方案。
How can I achieve this? 我怎样才能做到这一点?
<security mode="Transport">
<transport type="Certificate" />
<transport type="Basic" />
</security>
Thanks 谢谢
Did you tried to pass credential at message level. 您是否尝试在消息级别传递凭据。 Your config should look like:
您的配置应如下所示:
<security mode="Transport">
<transport clientCredentialType="Certificate" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
and then in the code 然后在代码中
WebServiceProxy objClient = new WebServiceProxy ();
objclient.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindBySubjectName, "clientCert");
objClient.ClientCredentials.UserName.UserName = "username";
objClient.ClientCredentials.UserName.Password = "Password";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.