-
Notifications
You must be signed in to change notification settings - Fork 28
Define Request From Local Cerificate #18
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please describe your use case in the pull requests description and how this will solve it?
README.md
Outdated
@@ -1,98 +1,29 @@ | |||
# Vault.NET [![Build status](https://ci.appveyor.com/api/projects/status/784hg5j70vcnumeb/branch/master?svg=true)](https://ci.appveyor.com/project/chatham/vault-net/branch/master) | |||
# Vault.NET Local Certificate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide the description of the change in the description of the pull request. This is the main README for the repository.
src/Vault/Vault.csproj
Outdated
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFramework)' == 'net45'"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are moving away from support specific .NET runtimes to ensure compatibility. Please target .NET Standard 1.1. There is another pull request already that removes .NET 4.5 specific support.
Validation custom certificate for Vault Callback Request
Add System.Net.Http.WebRequest for TargetFramework net45
Add Custom Certificate for NET45 with WebRequestHandler
Set the visibility method
In my use case I need to validate a certificate that resides in the local machine in order to ensure the correct communication with Vault placed on a host machine reachable on https.
To do this I introduced a new property in the VaultOptions that will be started with the path of the certified.
Within the VaultHttpClient class I inserted a method that initializes HttpClient with the result of the HttpClientinitialization () method which, in case the property is populated, passes the hundler parameter to HttpClient, thus specifying the certificate to be used with X509Certificate2. Otherwise the behavior of the plugin will remain unchanged.
I report the scenario with which the test was conducted:
public static async Task<Dictionary<string, string>> VaultAsync(string secretPath)
{
VaultOptions.Default.CertPath = new DirectoryInfo(
Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"...." + "AppData\cert.crt"))
).ToString();
}