【发布时间】:2016-11-06 20:50:09
【问题描述】:
我有一个保存用户数据的外部网络服务,我需要使用它来登录用户。如果可能,我想使用现有的 AccountController + UI 视图。我尝试添加 custom SignInManager 类来覆盖 PasswordSignInAsync,如下所示。
public class MySignInManager<ApplicationUser>
: SignInManager<ApplicationUser> where ApplicationUser : MyModels.ApplicationUser
但由于缺少存储用户信息的 EF 数据库而失败。我不需要 EF 数据库,因为这个外部 Web 服务将是我的数据源。
我读到我需要实现 UserManager 和 UserStore,但找不到带有 ASP.NET Core 版本的示例。有人可以指点我吗?
【问题讨论】:
-
只需实现
IUser*接口(取决于您希望商店支持哪些功能),然后将其注册到 IoC 容器(就像 Identity 在此处使用 EntityFramework github.com/aspnet/Identity/blob/… 一样)
标签: authentication asp.net-core asp.net-identity-3