dotnet / dotnet/MQTTnet

Use MqttClientDefaultCertificateValidationHandler.Handle() by default

Open
#1,547 3 comments 0 reactions 0 assignees View on GitHub
feature-request
Dominant language
C#
Stars
5.1k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

### Describe the feature request
For diagnostic purposes we use the CertificateValidationHandler callback.
We don't acutally do certificate validation there but only log diagnostic information.
After that we would like to defer certificate validation to the default implementation of MQTTnet.

There exists a so-called DefaultCertificateValidationHandler as `MqttClientDefaultCertificateValidationHandler.Handle()`, but it isn't used by MQTTnet (to the best of my knowledge).

The actual default implementation resides in `MqttTcpChannel.InternalUserCertificateValidationCallback()`, so we're not able to daisy-chain the default implementation to our callback function.

### Which project is your feature request related to?
- Client
- ManagedClient

### Describe the solution you'd like
A default implementation for DefaultCertificateValidationHandler that will be used if no CertificateValidationHandler callback has been set. The default implementation should be public so user code can call it before or after doing custom stuff.

### Describe alternatives you've considered
Copying the validation code from InternalUserCertificateValidationCallback() - not very elegant and needs to be synchronized if MQTTnet changes.

### Additional context
#1447

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with MqttClientDefaultCertificateValidationHandler.Handle() and MqttTcpChannel.InternalUserCertificateValidationCallback(), then review the Client and ManagedClient areas and issue #1447. Determine how the default handler is selected when no callback is configured and how user code can invoke it. Done means the public default implementation is used by default without duplicating validation logic.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.