mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 00:43:46 +00:00
[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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user