Description
The latest version of this package targets .NET Standard 2.0.
Use version 2.x if you need a version targetting .NET Standard 1.6. The source code of this version is available in branch 2.x for maintenance reasons.
To add the package to a project, you add the package to the csproj project file:
<ItemGroup>
<PackageReference Include="Digipolis.DataProtection.Postgres" Version="3.0.1" />
</ItemGroup>
or if your project still works with project.json :
"dependencies": {
"Digipolis.DataProtection.Postgres": "3.0.1"
}
ALWAYS check the latest version here before adding the above line !
Make sure you have our Nuget feed configured (https://www.myget.org/F/digipolisantwerp/api/v3/index.json).
In Visual Studio you can also use the NuGet Package Manager to do this.
This package offers an extension method on the IDataProtectionBuilder that allows configuring a Postgres store to persist the keys.
In the ConfigureServices method of your Startup add this line:
services.AddDataProtection().PersistKeysToPostgres(connectionString, appId, instanceId);
You need to pass a connection string to the database, an application id and an instance id.
Method signature:
PersistKeysToPostgres(string connectionString, Guid appId, Guid instanceId)
An integration test is available. Run ./run_integration_tests.sh
to run the integration tests.