Woof.Config
5.0.2
Prefix Reserved
As the package addresses application configuration - it's too important for the security to have even some minor bugs. The latest version has the support for DPAPI to protect the configuration with encryption. It is highly recommended to upgrade. Do not use protection for insensitive data due to the encryption costs, do not use as the only layer of data security where the extended security is required.
See the version list below for details.
dotnet add package Woof.Config --version 5.0.2
NuGet\Install-Package Woof.Config -Version 5.0.2
<PackageReference Include="Woof.Config" Version="5.0.2" />
paket add Woof.Config --version 5.0.2
#r "nuget: Woof.Config, 5.0.2"
// Install Woof.Config as a Cake Addin #addin nuget:?package=Woof.Config&version=5.0.2 // Install Woof.Config as a Cake Tool #tool nuget:?package=Woof.Config&version=5.0.2
Woof.Config
.NET extension created by CodeDog
Distributed under MIT License. (c)2021 by CodeDog, All rights reserved.
About
This is a tiny extension for Microsoft.Extensions.Configuration.IConfiguration
that reads configuration files from JSON files placed in the same directory as the entry assembly.
The configuration can be read using IConfiguration
interface methods, or bound to object property via
Microsoft.Extensions.Configuration.ConfigurationBinder.Bind
method.
It can also read some sensitive configuration data from Azure Key Vault.
Usage
Create JSON configuration file in main project directory, set its CopyToOutputDirectory
like
<None Update="Config.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Optionally, for a different configuration for the DEBUG mode, create another file like
<None Update="Config.dev.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Create the IConfiguration
instance like
var config = new JsonConfig("Config");
Optionally bind the config
instance to configuration object instance with Bind
method,
see included test project for further details.
To use AKV access, create similar Access.json file in main project directory:
{
"VaultUri": "[paste your vault URI here]",
"DirectoryId": "[paste your directory ID here]",
"ApplicationId": "[paste your application ID here]",
"ClientSecret": "[paste your client secret here]"
}
Create instance of the `AccessData` data with:
var accessData = new AccessData("Access");
Now you can read configured secrets for the application, also, encrypt and decrypt sensitive data using keys defined as secrets in AKV.
See the XML documentation of the `AccessData` class for details.
*IMPORTANT:* Since the configuration file contains client secret - it is sensitive and when put on a server the access to the file must be restricted!
When revoking client access is needed, it can be done from the AKV level, without touching the application.
Using credentials encryption provided in this module allows to achieve a kind of DPAPI equivalent on Linux servers.
All credentials in application database are encrypted and the keys are stored on AKV.
Important thing is when the AKV key is lost - the encrypted credentials will not be readable anymore,
so on production environments the encryption keys must be backed up.
Compatibility
The package is compatible with .NET Standard 2.1 and .NET 5.0 or newer. The applications using the module can run both on Windows and Linux.
Disclaimer
Please report any issues to the toolkit developer.
Woof Toolkit is a work in progress in constant development, however it's carefully maintained with production code quality.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Azure.Identity (>= 1.4.0)
- Azure.Security.KeyVault.Secrets (>= 4.2.0)
- Microsoft.Extensions.Configuration.Binder (>= 5.0.0)
- Microsoft.Extensions.Configuration.Json (>= 5.0.0)
-
net5.0
- Azure.Identity (>= 1.4.0)
- Azure.Security.KeyVault.Secrets (>= 4.2.0)
- Microsoft.Extensions.Configuration.Binder (>= 5.0.0)
- Microsoft.Extensions.Configuration.Json (>= 5.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
6.2.0-alpha.4 | 156 | 11/30/2021 | |
6.2.0-alpha.3 | 141 | 11/30/2021 | |
6.2.0-alpha.2 | 149 | 11/30/2021 | |
6.2.0-alpha.1 | 150 | 11/30/2021 | |
6.1.3 | 1,412 | 11/28/2021 | |
6.1.2 | 277 | 11/27/2021 | |
6.1.1 | 2,345 | 11/25/2021 | |
6.1.0 | 3,353 | 11/25/2021 | |
6.0.2 | 4,850 | 11/24/2021 | |
6.0.1 | 284 | 11/17/2021 | |
6.0.0 | 296 | 11/9/2021 | |
5.5.3 | 329 | 11/8/2021 | |
5.5.2 | 307 | 11/7/2021 | |
5.5.1 | 307 | 11/7/2021 | |
5.5.0 | 397 | 11/7/2021 | |
5.4.0 | 313 | 11/5/2021 | |
5.2.1 | 423 | 10/25/2021 | |
5.2.0 | 464 | 10/13/2021 | |
5.1.0 | 469 | 10/12/2021 | |
5.0.2 | 478 | 9/29/2021 | |
5.0.1 | 426 | 8/19/2021 | |
5.0.0 | 440 | 8/19/2021 | |
1.0.0 | 484 | 7/29/2021 |
Fixed bug when producing single file output on publish.