我们有一个使用IdentityServer4进行身份验证的web。我试图通过保留现有的DB来更改身份验证服务,以支持多租户。因此,每个租户都有单独的DB。
我目前正在努力配置ConfigurationStore和OperationalStore。
选项01:由于每个租户都有单独的DB,所以可以将ConfigurationDb和PersistedGrantDb相关表添加到这些DB中。
选项02:使用公共DB保存与ConfigurationDb和PersistedGrantDb相关的表。
什么是最好的方法?
services.AddIdentityServer()
// this adds the config data from DB (clients, resources, CORS)
.AddConfigurationStore(options =>
{
options.ConfigureDbContext = builder =>
builder.UseSqlServer(connectionString,
sql => sql.MigrationsAssembly(migrationsAssembly));
})
.AddOperationalStore(options =>
{
options.ConfigureDbContext = builder =>
builder.UseSqlServer(connectionString,
sql => sql.MigrationsAssembly(migrationsAssembly));
// this enables automatic token cleanup. this is optional.
options.EnableTokenCleanup = true;
options.TokenCleanupInterval = 30; // interval in seconds
});发布于 2018-11-16 04:38:22
我们无法找到在单独的DB中配置ConfigurationStore和OperationalStore的方法。从那时起,我们已经在我们的公共DB中配置了它们。因此,最终的DB结构如下所示。
https://stackoverflow.com/questions/52406927
复制相似问题