【问题标题】:Tenant based Configuration and Operational Store configuration基于租户的配置和操作存储配置
【发布时间】: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


    【解决方案1】:

    为什么需要为不同的“租户”分开 Db?您可以在“客户端”级别分离配置。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-29
      • 2013-09-04
      • 1970-01-01
      • 1970-01-01
      • 2021-12-11
      • 2012-08-11
      相关资源
      最近更新 更多