public void Should_set_client_certificate_as_authentication_identity_as_false_by_default() { var configurator = new RabbitMqHostConfigurator(new Uri("rabbitmq://localhost")); configurator.UseSsl(sslConfigurator => { }); configurator.Settings.UseClientCertificateAsAuthenticationIdentity.ShouldBeFalse(); }
public void Should_set_tls10_protocol_by_default() { var configurator = new RabbitMqHostConfigurator(new Uri("rabbitmq://localhost")); configurator.UseSsl(sslConfigurator => { }); configurator.Settings.SslProtocol.ShouldBe(SslProtocols.Tls); }
public void Should_set_client_certificate_as_authentication_identity_when_configured(bool valueToSet) { var configurator = new RabbitMqHostConfigurator(new Uri("rabbitmq://localhost")); configurator.UseSsl(sslConfigurator => { sslConfigurator.UseCertificateAsAuthenticationIdentity = valueToSet; }); configurator.Settings.UseClientCertificateAsAuthenticationIdentity.ShouldBe(valueToSet); }
public void Should_set_assigned_ssl_protocol() { var configurator = new RabbitMqHostConfigurator(new Uri("rabbitmq://localhost")); configurator.UseSsl(sslConfigurator => { sslConfigurator.Protocol = SslProtocols.Tls12; }); configurator.Settings.SslProtocol.ShouldBe(SslProtocols.Tls12); }
public void Should_use_custom_remote_certificate_validator_when_set() { RemoteCertificateValidationCallback customValidator = (sender, certificate, chain, sslPolicyErrors) => false; var configurator = new RabbitMqHostConfigurator(new Uri("rabbitmq://localhost")); configurator.UseSsl(sslConfigurator => { sslConfigurator.CertificateValidationCallback = customValidator; }); configurator.Settings.CertificateValidationCallback.ShouldBeSameAs(customValidator); }
public void Should_use_custom_client_certificate_selector_when_set() { LocalCertificateSelectionCallback customSelector = (sender, targetHost, localCertificates, remoteCertificate, acceptableIssuers) => null; var configurator = new RabbitMqHostConfigurator(new Uri("rabbitmq://localhost")); configurator.UseSsl(sslConfigurator => { sslConfigurator.CertificateSelectionCallback = customSelector; }); configurator.Settings.CertificateSelectionCallback.ShouldBeSameAs(customSelector); }
public static RabbitMqHostSettings ToRabbitMqHostSettings(this RabbitMqBusConfiguration configuration) { var hostConfiguration = new RabbitMqHostConfigurator(configuration.Host, configuration.VirtualHost, (ushort)configuration.Port) { PublisherConfirmation = true }; if (!string.IsNullOrEmpty(configuration.Username)) { hostConfiguration.Username(configuration.Username); } if (!string.IsNullOrEmpty(configuration.Password)) { hostConfiguration.Password(configuration.Password); } if (configuration.UseSsl) { hostConfiguration.UseSsl((x) => { x.Protocol = System.Security.Authentication.SslProtocols.Tls12; }); } return(hostConfiguration.Settings); }
/// <inheritdoc /> public virtual IRabbitMqHostBuilder UseSsl(Action <IRabbitMqSslConfigurator> configureSsl) { _hostConfigurator.UseSsl(configureSsl); return(this); }