Tingle.AspNetCore.DataProtection.MongoDB
4.12.0
See the version list below for details.
dotnet add package Tingle.AspNetCore.DataProtection.MongoDB --version 4.12.0
NuGet\Install-Package Tingle.AspNetCore.DataProtection.MongoDB -Version 4.12.0
<PackageReference Include="Tingle.AspNetCore.DataProtection.MongoDB" Version="4.12.0" />
paket add Tingle.AspNetCore.DataProtection.MongoDB --version 4.12.0
#r "nuget: Tingle.AspNetCore.DataProtection.MongoDB, 4.12.0"
// Install Tingle.AspNetCore.DataProtection.MongoDB as a Cake Addin #addin nuget:?package=Tingle.AspNetCore.DataProtection.MongoDB&version=4.12.0 // Install Tingle.AspNetCore.DataProtection.MongoDB as a Cake Tool #tool nuget:?package=Tingle.AspNetCore.DataProtection.MongoDB&version=4.12.0
Tingle.AspNetCore.DataProtection.MongoDB
Web applications often need to store security-sensitive data. Windows provides DPAPI for desktop applications, but this is unsuitable for web applications especially when running in a Docker container. The ASP.NET Core data protection stack provide a simple, easy to use cryptographic API a developer can use to protect data, including key management and rotation.
Microsoft has already provided ways to persist data protection keys to various storage systems.
This package provides the functionality to persist the data protection keys to MongoDB.
Using Dependency Injection
public void ConfigureServices(IServicesCollection services)
{
services.AddSingleton<IMongoClient>(p => new MongoClient("mongodb://localhost:27017/my-database"));
services.AddDataProtection()
.PersistKeysToMongo();
}
Sample Usage
[Route("api/v1/[controller]")]
public class DummyController : ControllerBase
{
IDataProtector _protector;
public DummyController(IDataProtectionProvider provider)
{
_protector = provider.CreateProtector(nameof(DummyController));
}
[HttpGet]
public Task<IActionResult> TestAsync([FromQuery] string value)
{
string protectedPayload = _protector.Protect(value);
string unprotectedPayload = _protector.Unprotect(protectedPayload);
// unprotectedPayload and value should be the same
return Ok();
}
}
The PersistKeysToMongo
can be configured to store keys in databases and collections of your choice. By default, data protection keys will be stored in a database and collection named DataProtection
and DataProtection-Keys
respectively.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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 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 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net6.0
- MongoDB.Driver (>= 2.27.0)
-
net7.0
- MongoDB.Driver (>= 2.27.0)
-
net8.0
- MongoDB.Driver (>= 2.27.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 |
---|---|---|
5.0.0 | 121 | 11/19/2024 |
4.14.1 | 415 | 10/14/2024 |
4.14.0 | 141 | 9/16/2024 |
4.13.0 | 252 | 8/13/2024 |
4.12.0 | 149 | 8/7/2024 |
4.11.2 | 194 | 7/15/2024 |
4.11.1 | 173 | 6/26/2024 |
4.11.0 | 192 | 6/6/2024 |
4.10.1 | 95 | 6/5/2024 |
4.10.0 | 185 | 5/27/2024 |
4.9.0 | 147 | 5/16/2024 |
4.8.0 | 169 | 5/5/2024 |
4.7.0 | 259 | 3/25/2024 |
4.6.0 | 276 | 3/8/2024 |
4.5.0 | 633 | 11/22/2023 |
4.4.1 | 152 | 11/20/2023 |
4.4.0 | 141 | 11/15/2023 |
4.3.0 | 291 | 10/18/2023 |
4.2.2 | 322 | 9/20/2023 |
4.2.1 | 252 | 8/4/2023 |
4.2.0 | 280 | 5/31/2023 |
4.1.1 | 162 | 5/26/2023 |
4.1.0 | 150 | 5/22/2023 |
4.0.0 | 302 | 3/14/2023 |
2.5.0 | 538 | 11/21/2022 |
2.4.2 | 725 | 7/25/2022 |
2.4.1 | 625 | 3/22/2022 |
2.4.0 | 450 | 11/10/2021 |
2.3.1 | 460 | 9/20/2021 |
2.3.0 | 471 | 7/22/2021 |