【问题标题】:.Net 4.6 equivalent of .NET Core Identity password hashing.Net 4.6 等效于 .NET Core Identity 密码哈希
【发布时间】:2018-02-02 03:39:40
【问题描述】:
我有一个要求,我需要能够通过基于 ASP.NETCore 的 Web 应用程序以及 Windows 应用程序 (.NET 4.6) 创建用户。同一用户可用于登录网站和 WindowsApp。使用的凭据存储是 SQL Server 数据库。我将 ASP.NET Core Identity 与 Web 应用程序的默认 PasswordHashing 实现一起使用。但是我遇到的问题是在通过 WindowsApplication 创建用户时尝试复制相同的 PasswordHashing 算法。实现这一目标的最简单方法是什么?
【问题讨论】:
标签:
asp.net-core
asp.net-core-identity
【解决方案1】:
您可以配置 ASP.NET Core Identity PasswordHashing 实现以使用 V2 版本 - 从而与 Identity 2 的行为保持一致(我猜您在 .NET 框架 Windows 应用程序中使用)。
在 web 应用的 startup.cs 中,添加这一行:
services.Configure<PasswordHasherOptions>(options => options.CompatibilityMode = PasswordHasherCompatibilityMode.IdentityV2);
所有通过网络创建的密码都必须重置。