Woof.Config 5.2.1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Woof.Config --version 5.2.1
NuGet\Install-Package Woof.Config -Version 5.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Woof.Config" Version="5.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Woof.Config --version 5.2.1
#r "nuget: Woof.Config, 5.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Woof.Config as a Cake Addin
#addin nuget:?package=Woof.Config&version=5.2.1

// Install Woof.Config as a Cake Tool
#tool nuget:?package=Woof.Config&version=5.2.1

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 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 146 11/30/2021
6.2.0-alpha.3 131 11/30/2021
6.2.0-alpha.2 139 11/30/2021
6.2.0-alpha.1 134 11/30/2021
6.1.3 1,386 11/28/2021
6.1.2 252 11/27/2021
6.1.1 2,324 11/25/2021
6.1.0 3,330 11/25/2021
6.0.2 4,826 11/24/2021
6.0.1 255 11/17/2021
6.0.0 274 11/9/2021
5.5.3 304 11/8/2021
5.5.2 283 11/7/2021
5.5.1 297 11/7/2021
5.5.0 373 11/7/2021
5.4.0 290 11/5/2021
5.2.1 391 10/25/2021
5.2.0 434 10/13/2021
5.1.0 439 10/12/2021
5.0.2 451 9/29/2021
5.0.1 394 8/19/2021
5.0.0 409 8/19/2021
1.0.0 448 7/29/2021

IConfiguration is writeable.