Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.47 KB

File metadata and controls

48 lines (33 loc) · 1.47 KB

MongoDB data protection implementation

NuGet GitHub release (latest by date) GitHub

Description

This library implements a Microsoft DataProtection abstraction using MongoDB as a data protection store.

Install

For use you needed install packages:

Install-Package Skidbladnir.Modules
Install-Package Skidbladnir.DataProtection.MongoDB

Using

To use the data protection, you need enable data protection using extension method PersistKeysToMongoDb(string connectionString, string collectionName = null) on IDataProtectionBuilder or AddDataProtectionMongoDb(string connectionString, string collectionName = null) on IServiceCollection.

Enable Data Protection MongoDb in Startup.cs

PersistKeysToMongoDb:

public void ConfigureServices(this IServiceCollection services)
{
    services.AddDataProtection()
        .PersistKeysToMongoDb("ConnectionString");
}

IServiceCollection:

public void ConfigureServices(this IServiceCollection services)
{
    services.AddDataProtection();
    services.AddDataProtectionMongoDb("ConnectionString");
}