开发者

How can I read the Clientcertificate within a WCF service?

I do host a WCF service on a server which requires the clients to authenticate using a x509 certificate. I need to read this certificate inside the service as the data contained is part of the business logic.

The binding I use for the WCF service is webHttpBinding with security set to "Transport" and clientCredenti开发者_高级运维alType="certificate".

In ASP.net I can use the HttpContext.Current, which however is not available in WCF. What can I do to still get the certificate from the user?

Kind regards, Alois


The article on http://blogs.msdn.com/b/wenlong/archive/2006/01/23/516041.aspx provided me with the solution to this problem. WCF allows to run in "ASP.net compatibility mode" which brings back the full HttpContext object.


I use this in my WCF service, with ASP.net compatibility disabled:

var x509ClaimSet = OperationContext.Current.ServiceSecurityContext.AuthorizationContext.ClaimSets.FirstOrDefault() as X509CertificateClaimSet;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜