【发布时间】:2021-05-24 13:57:45
【问题描述】:
我们有多租户应用程序,因此我们只能使用特定租户数据库中的操作和配置存储数据。是否可以配置而不是下面的代码?
这将在启动 id 服务器应用程序时仅运行一次,但我想根据租户请求注册以下服务,因此只有当前租户数据库将存储操作和配置存储表的值。
// configure identity server with in-memory stores, keys, clients and scopes
services.AddIdentityServer()
.AddDeveloperSigningCredential()
.AddTestUsers(Config.GetUsers())
// this adds the config data from DB (clients, resources)
.AddConfigurationStore(options =>
{
options.ConfigureDbContext = builder =>
builder.UseSqlServer(connectionString,
sql => sql.MigrationsAssembly(migrationsAssembly));
})
// this adds the operational data from DB (codes, tokens, consents)
.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;
});
【问题讨论】:
标签: .net asp.net-core identityserver4