很长时间的读者,第一次海报。
目标:
我们希望创建一个自己托管的Web 2服务,该服务专为身份验证目的使用客户端证书。为了开发目的,数据服务层将在与客户端层相同的机器上运行。
环境/配置:
<access sslFlags="Ssl, SslRequireCert"/>。- IIS 此模式还使用SSL证书进行了正确配置,并需要通过IIS设置客户端证书。
- "Legacy" Web API 2 self-hosted console app SSL已通过netsh正确绑定到端口,设置为"clientcertnegotiation=true“。
配置已将ClientCredentialType设置为证书。
- OWIN Web API 2 self-hosted console app -- SSL已通过clientcertnegotiation=true设置正确地绑定到端口。
WebRequestHandler handler = new WebRequestHandler(); handler.ClientCertificateOptions = ClientCertificateOption.Manual; handler.ClientCertificates.Add(MyCertificates.OfType<X509Certificate2>).FirstOrDefault(cert => cert.Thumbprint == SelectedCertificateThumbprint) as X509Certificate2); handler.UseDefaultCredentials = true; HttpClient client = new HttpClient(handler); client.BaseAddress = SetServiceBaseAddress(client); var results = client.PostAsync(<RequestURI>, <RequestDTO>, mediaTypeFormatter).Result;制约因素:
我们无权在这些机器上安装Wireshark或任何其他网络监控工具。
行为:
1. Fiddler will prompt a certificate warning due to a name mismatch for SSL (we haven't turned this off or generated one for localhost.fiddler).
2. Fiddler will prompt for a "Request For Permission to Use a Key". We believe this is a request to access the .pfx stored in Current User\Personal store based on the certificate (.cer) that is stored in the Fiddler directory so that Fiddler sign the request with the proper private key.
3. After entering the proper password, the request succeeds.
1. Fiddler will prompt a certificate warning due to a name mismatch for SSL (we haven't turned this off or generated one for localhost.fiddler).
2. A 403.7 - Forbidden is received immediately.
1. A successful response is received.
假设:
问题:
发布于 2014-04-13 22:38:53
我只是忙着处理一个类似的问题,我想我偶尔会找到你的第二个问题的答案。
关键在于如何使用netsh工具将服务器证书绑定到端口。
将clientnegotiation参数设置为启用的时,如下所示:
netsh http add sslcert ipport=0.0.0.0:443 certhash=<cert_thumbprint> appid={some_guid} clientcertnegotiation=enable,OWIN主机开始要求客户端提供某种客户端证书(它可以是任何类型的证书)。
当将该参数设置为禁用或忽略它时,OWIN主机不需要客户机提供任何内容。
https://stackoverflow.com/questions/20613658
复制相似问题