Custom certificate validation in WCF service

后端 未结 3 1257
情话喂你
情话喂你 2020-12-05 20:03

I want to check client certificates in my WCF service.

My goal is to allow only clients with certificates with specific thumbprints to be able to communicate with my

相关标签:
3条回答
  • 2020-12-05 20:42

    I do NOT think there is anyway to have 'Custom Certificate Validation' with 'Transport Security'. It only works with 'Message Security'.

    0 讨论(0)
  • 2020-12-05 20:44

    You can create a class derived from X509CertificateValidator and use it to do custom validation of the incoming certificate. Throw an SecurityTokenValidationException if you want to fail validation for some reason.

    Set the certificateValidationMode to Custom and specify your validator in the clientCertificate service behavior section of the config file.

    How to: Create a Service that Employs a Custom Certificate Validator

    0 讨论(0)
  • 2020-12-05 20:48

    YES, you can use basicHttpBinding with security set to Transport and you need to hook to the ServiceHost creation in IIS - see Custom Service Host. You should be able to validate thumbprint values, certificates or any other data if you create custom config section to define list of validation criteria.

    Sample code for the implementation of all of the above is available in the code download from this CodeProject artticle.

    0 讨论(0)
提交回复
热议问题