简体   繁体   English

WCF客户端具有客户端证书和基本身份验证

[英]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.

相关问题 具有基本证书验证和客户端证书验证的WCF客户端 - WCF Client with both Basic and Client Certificate Authentication WCF和客户端证书身份验证 - WCF and client certificate authentication 使用基本身份验证和客户端证书调用WCF服务 - Calling WCF Service with basic auth and client certificate 客户端在WCF中是否需要用于用户名身份验证的证书 - Does the client need a certificate for username authentication in WCF WCF 客户端证书验证 + Windows 身份验证 - WCF Client Certificate Validation + Windows Authentication 以编程方式配置WCF服务客户端和证书身份验证 - Configure WCF service client with certificate authentication programmatically WCF wsHttpBinding客户端证书身份验证,不使用客户端中的存储 - WCF wsHttpBinding Client Certificate Authentication without using store in client 具有客户端证书身份验证的WCF不适用于soapui - Wcf with client certificate authentication doesn't work with soapui 来自同一主机上的 Invoke-WebRequest 的 WCF 客户端证书身份验证 - WCF client certificate authentication from Invoke-WebRequest on the same host 具有客户端证书认证的SignalR - SignalR with Client Certificate Authentication
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM