Question

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 clientCredentialType="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

Was it helpful?

Solution

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.

OTHER TIPS

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

var x509ClaimSet = OperationContext.Current.ServiceSecurityContext.AuthorizationContext.ClaimSets.FirstOrDefault() as X509CertificateClaimSet;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top