Skip to content

Conversation

@bednar
Copy link
Contributor

@bednar bednar commented May 11, 2022

Closes #321

Proposed Changes

Add possibility to custom validation of SSL certificates:

var cert = new X509Certificate2("path_to_file");

var options = new InfluxDBClientOptions.Builder()
    .Url("http://localhost:8086")
    .AuthenticateToken("my-token")
    .RemoteCertificateValidationCallback((sender, certificate, chain, errors) => 
        errors == SslPolicyErrors.None || string.Equals(cert.Thumbprint, certificate?.GetCertHashString(), StringComparison.InvariantCultureIgnoreCase))
    .Build();

using var client = InfluxDBClientFactory.Create(options);

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • dotnet test completes successfully
  • Commit messages are in semantic format
  • Sign CLA (if not already signed)

@codecov-commenter
Copy link

codecov-commenter commented May 11, 2022

Codecov Report

Merging #323 (3b9e043) into master (042c900) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #323      +/-   ##
==========================================
+ Coverage   88.19%   88.21%   +0.01%     
==========================================
  Files          76       76              
  Lines        6555     6565      +10     
==========================================
+ Hits         5781     5791      +10     
  Misses        774      774              
Impacted Files Coverage Δ
Client/InfluxDBClientOptions.cs 95.40% <100.00%> (+0.14%) ⬆️
Client/Internal/ApiClient.cs 90.26% <100.00%> (+0.35%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 042c900...3b9e043. Read the comment docs.

@bednar bednar requested a review from rhajek May 11, 2022 07:37
@bednar bednar marked this pull request as ready for review May 11, 2022 07:37
Copy link
Contributor

@rhajek rhajek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bednar bednar merged commit 9d90495 into master May 12, 2022
@bednar bednar deleted the custom_certificate_validation branch May 12, 2022 07:02
@bednar bednar added this to the 4.2.0 milestone May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow certificate verification against known self signed certificate

4 participants