【发布时间】:2019-05-14 04:31:39
【问题描述】:
我目前正在使用 IdentityServer4 添加 ASP.NET Core Identity。
我添加了类似于下面一行的身份。
services.AddDbContext<PublicApplicationDbContext>(options =>
options.UseSqlServer(
connection))
.AddIdentity<PublicIdentityUser, PublicIdentityRole>(opts =>
{
opts.Password.RequiredLength = 6;
})
.AddDefaultTokenProviders()
.AddEntityFrameworkStores<PublicApplicationDbContext>();
我想要一个类似的存储库,所以我创建了一组单独的内部对象,例如 InternalApplicationDbContext、InternalIdentityUser。我认为这就像配置上述步骤并注入它一样简单......
UserManager<InternalIdentityUser>
但是,它似乎不起作用,并且我收到与此类似的错误。 方案已存在 https://github.com/aspnet/AspNetCore.Docs/issues/8223
我已经阅读了一些与此相关的文档,但没有任何迹象表明它支持多个身份提供者。是这种情况还是我错过了什么?
总而言之,我想要两个独立的数据库来管理用户,一个用于公共用户,另一个用于内部用户。我想使用内置的身份 API UserManager 来封装实现,因为我真的不想构建自己的。
【问题讨论】:
标签: c# .net-core asp.net-identity identityserver4