This library implements a Microsoft DataProtection abstraction using MongoDB as a data protection store.
For use you needed install packages:
Install-Package Skidbladnir.Modules
Install-Package Skidbladnir.DataProtection.MongoDB
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
.
PersistKeysToMongoDb
:
public void ConfigureServices(this IServiceCollection services)
{
services.AddDataProtection()
.PersistKeysToMongoDb("ConnectionString");
}
IServiceCollection
:
public void ConfigureServices(this IServiceCollection services)
{
services.AddDataProtection();
services.AddDataProtectionMongoDb("ConnectionString");
}