0
設置數據保護和Identity時,Identity已經需要一個內置的IDataProtectionProvider,而數據保護API不提供此功能。如何設置Identity的Cookie數據保護以使用Azure存儲Data Protector
ConfigureServices
IDataProtectionBuilder protectionBuilder = services
.AddDataProtection()
.PersistKeysToAzureBlobStorage(storageContainer, "keys.xml");
services.AddIdentity<ApplicationUser, IdentityRole>(options =>
{
options.Cookies.ApplicationCookie.DataProtectionProvider = //NEEDS AN IDataProtectionProvider
}
對於自定義的cookie可以在以後設置,在配置:
相關的文檔: https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/compatibility/cookie-sharing