JF91.VaultSharp
0.0.3
dotnet add package JF91.VaultSharp --version 0.0.3
NuGet\Install-Package JF91.VaultSharp -Version 0.0.3
<PackageReference Include="JF91.VaultSharp" Version="0.0.3" />
paket add JF91.VaultSharp --version 0.0.3
#r "nuget: JF91.VaultSharp, 0.0.3"
// Install JF91.VaultSharp as a Cake Addin #addin nuget:?package=JF91.VaultSharp&version=0.0.3 // Install JF91.VaultSharp as a Cake Tool #tool nuget:?package=JF91.VaultSharp&version=0.0.3
JF91.VaultSharp
WIP Minimalist Vault Client.
1: Install Nuget Package
dotnet add package JF91.VaultSharp
<br>
Available authentication methods:
- Token
- App Role
Available features:
- Get all secrets from path
- Get secret name value
- Get secret name value and update appsettings.json (Currently limited to one nested property)
<br>
How to use:
Add this to your appsettings.json:
"VaultSettings": {
"AuthenticationMethod": "approle",
"Host": "http://localhost:8200",
"RoleId": "",
"SecretId": "",
"Token": ""
}
Possible values:
- AuthenticationMethod: approle, token
<br>
All methods are extensions methods from IConfiguration, which you can inject anywhere in your application and call them like this:
private readonly IConfiguration _configuration;
public MyController
(
IConfiguration configuration
)
{
_configuration = configuration;
}
[HttpGet(Name = "MyEndpoint")]
public ActionResult HelloWorld()
{
var secrets = _configuration.GetVaultSecrets
(
"kv",
"secretPath"
);
var secretValue = _configuration.GetVaultSecret
(
"kv",
"secretPath",
"secretName"
);
_configuration.InjectSecretToConfiguration
(
"kv",
"test",
"test2",
"Secrets:Test",
"Development" // Application Environment
);
_configuration.InjectSecretToConfiguration
(
"kv",
"test",
"test2",
"Secrets:Nested:Test",
"Development" // Application Environment
);
_configuration.InjectSecretToConfiguration
(
"kv",
"test",
"test2",
"Secrets:Child[1]:Test",
"Development" // Application Environment
);
return "Hello World!";
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 7.0.4)
- Newtonsoft.Json (>= 13.0.3)
- VaultSharp (>= 1.13.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
0.0.3:
# Added ability to update any nested settings including object arrays.
0.0.2:
# Added method to retrieve secret value from Vault and update appsettings.json
# Added Token authentication
0.0.1:
# AppRole Authentication
# Vault settings from appsettings.json
# Added method: Get Vault Secret