Skip to content

Commit

Permalink
Also expose sender to event arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
chkr1011 committed Aug 19, 2023
1 parent bb8cb0f commit 7ad56c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ public sealed class MqttClientCertificateValidationEventArgs : EventArgs

public X509Chain Chain { get; set; }

public SslPolicyErrors SslPolicyErrors { get; set; }

public IMqttClientChannelOptions ClientOptions { get; set; }
#if NET452 || NET461 || NET48
/// <summary>
/// Can be a host string name or an object derived from WebRequest.
/// </summary>
public object Sender { get; set; }
#endif

public SslPolicyErrors SslPolicyErrors { get; set; }
}
}
}
4 changes: 3 additions & 1 deletion Source/MQTTnet/Implementations/MqttWebSocketChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,11 @@ void SetupClientWebSocket(ClientWebSocket clientWebSocket)
#elif WINDOWS_UWP
throw new NotSupportedException("Remote certificate validation callback is not supported when using 'uap10.0'.");
#elif NET452 || NET461 || NET48
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => {
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) =>
{
var context = new MqttClientCertificateValidationEventArgs
{
Sender = sender,
Certificate = certificate,
Chain = chain,
SslPolicyErrors = sslPolicyErrors,
Expand Down

0 comments on commit 7ad56c0

Please sign in to comment.