Method PersistKeysToRedb(IDataProtectionBuilder)
Persists ASP.NET DataProtection XML keys in redb.
Usage: services.AddDataProtection().PersistKeysToRedb();
The key manager reads its repository from
only; a repository merely registered in DI is ignored and the key ring falls back to the file
system of the process user. So the repository is set on the options, as
PersistKeysToFileSystem and PersistKeysToDbContext do. An XML encryptor set on
the same options (ProtectKeysWith*) keeps working: the repository stores what it is
given.
The repository is a Singleton. Persistence opens a fresh
scope per call to avoid capturing a Scoped
(A1 captive-dependency rule).
public static IDataProtectionBuilder PersistKeysToRedb(this IDataProtectionBuilder builder)