Havret / dotnet-activemq-artemis-client

.NET Client for Apache ActiveMQ Artemis
https://havret.github.io/dotnet-activemq-artemis-client/
MIT License
63 stars 11 forks source link

Expose SslSettings on ConnectionFactory #465

Closed Havret closed 11 months ago

Havret commented 11 months ago

Feature description

Expose SslSettings on ConnectionFactory:

Feature in action

var factory = new ConnectionFactory();

// Setup SSL settings
factory.SSL.ClientCertificates = new X509CertificateCollection { new X509Certificate("path_to_your_certificate.pfx") };
factory.SSL.Protocols = SslProtocols.Tls12;
factory.SSL.CheckCertificateRevocation = true;
factory.SSL.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
{
    // Here you can add custom validation logic
    return sslPolicyErrors == SslPolicyErrors.None;
};
factory.SSL.LocalCertificateSelectionCallback = (sender, targetHost, localCertificates, remoteCertificate, acceptableIssuers) =>
{
    // Here you can add custom logic to select the best certificate for authentication
    return localCertificates[0];
};