如何提供默认PasswordHasherOptions的替代,以便AspNetCore V3 PasswordHasher使用PasswordHasherOptions V2 ?
V3 PasswordHasher extension default constructor
需要IOptions<PasswordHasherOptions>
,什么是AddSingleton ???提供自定义PasswordHasherOptions的语法?将PasswordHasherCompatibilityMode设置为'IdentityV2'
与Aspidentity 2.2 (framework 4.x) reused on AspnetCore AspIdentity
有关答案 0 :(得分:1)
使用services.Configure
(在Startup.ConfigureServices
中)注册IOptions
配置对象。在这种情况下,最简单的方法是使用overload that takes a delegate:
services.Configure<PasswordHasherOptions>(o => o.CompatibilityMode = PasswordHasherCompatibilityMode.IdentityV2);