asp.net - 在 AspnetCore AspIdentity 上重用的 Aspidentity 2.2(框架 4.x)
问题描述
现有:aspnet webapp 和 dB,使用 aspidentity 在控制器上 [Authorize]
新:AspnetCore 应用程序,如何使用“旧”的 aspidentity DB 进行授权?
解决方案
AspNet 解决方案:
数据库更新:https ://github.com/CK159/CoreXplore/tree/master/Db/Migrations/Identity2Core
为新列添加迁移。
- 更新新的 AspNetUsers ApplicationUser 类属性:
ConcurrencyStamp = System.Guid.New(); NormalizedEmail = Email.Upper(); NormalizedUserName = Email.Upper();
- 使用新属性和默认值更新新的 ApplicationUser
AspNetCore 解决方案:
- 在兼容模式下配置 aspnetcore PasswordHasher 使用 V2 选项。V3登录AspNetCore解决方案,用户无法登录AspNet解决方案:by
services.Configure<PasswordHasherOptions>(o => o.CompatibilityMode = PasswordHasherCompatibilityMode.IdentityV2);
- 连接字符串指向现有数据库
- 部署在与退出 Azure 上的 WebApp 相同的 WebApp“主机”中,这样它将共享相同的机器密钥(不完全确定这是必要的)。
推荐阅读
- python - python对列表中的链接进行排序
- php - Angular IO 与 Laravel Lumen PHP API CORS 问题
- html - 将多个动画应用于html中的元素
- c++ - 打印字符串的偶数索引字符和奇数索引字符时测试用例失败
- docker - 如何使用 nginx 运行两个独立的 docker 容器?
- shopware - 安装商店软件 6 时出现 Slim 应用程序错误
- c++ - 如何使用 LLVM C++ api 生成 while 循环
- terraform - 将多个静态 IP 添加到 terraform 提供程序/资源 vSphere vsphere_virtual_machine
- haskell - 如何在Haskell中生成两个整数(最小值和最大值)内的所有整数列表?
- botframework - BotFramework Composer 中的多项选择动态选择选项