Skip to content

Commit 18419cb

Browse files
Merge pull request #389 from paulomorgado/default-amqp-ssl-protocols
Add a static property to AmqpTcpEndpoint to specify the default SSL protocol versions and use it on ConnectionFactory.SetUri
2 parents f05ab6e + bf2a799 commit 18419cb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

projects/client/RabbitMQ.Client/src/client/api/ConnectionFactory.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
using System.Collections.Generic;
4646
using System.Threading.Tasks;
4747
using System.Linq;
48+
using System.Security.Authentication;
4849

4950
#if !NETFX_CORE
5051

@@ -141,6 +142,18 @@ public class ConnectionFactory : ConnectionFactoryBase, IAsyncConnectionFactory
141142
/// <remarks> PLEASE KEEP THIS MATCHING THE DOC ABOVE.</remarks>
142143
public const string DefaultVHost = "/";
143144

145+
/// <summary>
146+
/// The default AMQP URI SSL protocols.
147+
/// </summary>
148+
public static SslProtocols DefaultAmqpUriSslProtocols { get; set; } =
149+
SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;
150+
151+
/// <summary>
152+
/// The AMQP URI SSL protocols.
153+
/// </summary>
154+
public SslProtocols AmqpUriSslProtocols { get; set; } =
155+
DefaultAmqpUriSslProtocols;
156+
144157
/// <summary>
145158
/// Default SASL auth mechanisms to use.
146159
/// </summary>
@@ -517,6 +530,7 @@ private void SetUri(Uri uri)
517530
else if (string.Equals("amqps", uri.Scheme, StringComparison.OrdinalIgnoreCase))
518531
{
519532
Ssl.Enabled = true;
533+
Ssl.Version = AmqpUriSslProtocols;
520534
#if !(NETFX_CORE)
521535
Ssl.AcceptablePolicyErrors = SslPolicyErrors.RemoteCertificateNameMismatch;
522536
#endif

0 commit comments

Comments
 (0)