[csharp-netcore] Enable setting of RemoteCertificateValidationCallback through IReadableConfiguration (#15979)

* Fix for [BUG][C#][csharp] Use RestClient.RemoteCertificateValidationCallback for SSL validation #11497

* Fixed modification of wrong files through merging to master and applied the changes to the correct files

* Updated examples

* Forget some examples

* Updates branch to reflect master changes and published changed example files yet again to solve conflicts

* Fixed examples
This commit is contained in:
Daniel Lange
2023-07-06 05:48:10 +02:00
committed by GitHub
parent 965eb2a02f
commit 6b62f2b05a
31 changed files with 183 additions and 20 deletions

View File

@@ -18,6 +18,7 @@ using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net.Http;
using System.Net.Security;
namespace Org.OpenAPITools.Client
{
@@ -624,6 +625,11 @@ namespace Org.OpenAPITools.Client
get { return _HttpSigningConfiguration; }
set { _HttpSigningConfiguration = value; }
}
/// <summary>
/// Gets and Sets the RemoteCertificateValidationCallback
/// </summary>
public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
@@ -701,7 +707,8 @@ namespace Org.OpenAPITools.Client
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
UseDefaultCredentials = second.UseDefaultCredentials
UseDefaultCredentials = second.UseDefaultCredentials,
RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}

View File

@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
namespace Org.OpenAPITools.Client
@@ -135,5 +136,11 @@ namespace Org.OpenAPITools.Client
/// Gets the HttpSigning configuration
/// </summary>
HttpSigningConfiguration HttpSigningConfiguration { get; }
/// <summary>
/// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
/// overriding certificate errors in the scope of a request.
/// </summary>
RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
}
}