fixer-m / snowflake-db-net-client

Snowflake .NET Client
Apache License 2.0
51 stars 14 forks source link

Added the ability to do the SSL Cert bypass via constructer #22

Closed mbwilding closed 2 years ago

mbwilding commented 2 years ago

Added the ability to do the SSL Cert bypass via constructor Fixed spelling mistakes and adjusted things to match the C# naming conventions Updated to use object initializers.

mbwilding commented 2 years ago

Tested and working, using this change in production inside an AWS Lambda .NET 6 (ARM64) with and without a docker container.

fixer-m commented 2 years ago

Hi! Thanks for this PR. Sorry, I didn't have much time for this project recently, but I'm trying to make time for it at least once in a month. Bypassing SSL check was already possible with overriding internal HttpClient:

var handler = new HttpClientHandler
{
    SslProtocols = SslProtocols.Tls12,
    CheckCertificateRevocationList = true,
    ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true // i.e. bypass cert validation
};
var httpClient = new HttpClient(handler);

var authInfo = new AuthInfo("user", "password", "xyz", "region");
var urlInfo = new UrlInfo() { Host = "hostname" };
var snowflakeClient = new SnowflakeClient(authInfo, null, urlInfo);
snowflakeClient.SetHttpClient(httpClient); // override internal http client 

However dedicated configuration option might be more convenient - I'll think about this. As for this PR - it does have too many changes at once. I like most code style fixes, but in some rare cases I think they do hurt readability (and sometimes IDE suggests just bad changes). So I have reviewed all solution for IDE fix suggestions and applied most of them in my own commit.