Add options builder methods for remote certificate validation callback.

This commit is contained in:
Christian Kratky
2019-07-11 23:03:56 +02:00
parent 1ae3324581
commit e7ba3f76dc
3 changed files with 13 additions and 2 deletions
+1
View File
@@ -16,6 +16,7 @@
* [Server] Exposed CONNECT packet properties in Application Message and Subscription interceptor. * [Server] Exposed CONNECT packet properties in Application Message and Subscription interceptor.
* [Server] Fixed: Sending Large packets with AspnetCore based connection throws System.ArgumentException. * [Server] Fixed: Sending Large packets with AspnetCore based connection throws System.ArgumentException.
* [Server] Fixed wrong usage of socket option _NoDelay_. * [Server] Fixed wrong usage of socket option _NoDelay_.
* [Server] Added remote certificate validation callback (thanks to @rudacs).
* [MQTTnet.Server] Added REST API for publishing basic messages. * [MQTTnet.Server] Added REST API for publishing basic messages.
</releaseNotes> </releaseNotes>
<copyright>Copyright Christian Kratky 2016-2019</copyright> <copyright>Copyright Christian Kratky 2016-2019</copyright>
@@ -1,5 +1,6 @@
using System; using System;
using System.Net; using System.Net;
using System.Net.Security;
using System.Security.Authentication; using System.Security.Authentication;
namespace MQTTnet.Server namespace MQTTnet.Server
@@ -98,7 +99,15 @@ namespace MQTTnet.Server
_options.TlsEndpointOptions.IsEnabled = false; _options.TlsEndpointOptions.IsEnabled = false;
return this; return this;
} }
#if !WINDOWS_UWP
public MqttServerOptionsBuilder WithRemoteCertificateValidationCallback(RemoteCertificateValidationCallback value)
{
_options.TlsEndpointOptions.RemoteCertificateValidationCallback = value;
return this;
}
#endif
public MqttServerOptionsBuilder WithStorage(IMqttServerStorage value) public MqttServerOptionsBuilder WithStorage(IMqttServerStorage value)
{ {
_options.Storage = value; _options.Storage = value;
@@ -16,8 +16,9 @@ namespace MQTTnet.Server
public bool CheckCertificateRevocation { get; set; } public bool CheckCertificateRevocation { get; set; }
#if !WINDOWS_UWP
public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endif
public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12; public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12;
} }
} }