【发布时间】:2020-11-20 14:23:24
【问题描述】:
我有一个问题!.. 我需要使用 N-tenant 及其身份验证提供程序(Azure AD all..)实现 IdentityServer。 例如: 租户 1 ... AzureAD-1 租户 2 ... AzureAD-2 租户 3 ... AzureAD-3 (...) TenantN ... 重定向 AzureAD-N 有可能吗? 另外,我需要从数据库中获取租户信息(它是clientId、client secret、callbackPath等)。 我的第一种方法是:
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
(...)
IEnumerable<AuthenticationSchema> schemas = repository.GetAuthenticationSchemas();
if (schemas != null && schemas.Count() > 0)
{
foreach (AuthenticationSchema schema in schemas)
builder.AddOpenIdConnect(schema.Id, options =>
{
options.Authority = schema.Authority;
options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = false };
options.ClientId = schema.ClientId;
options.ClientSecret = schema.ClientSecret;
options.CallbackPath = schema.CallBackPath;
});
}
(...)
}
}
这种方法有一个问题,如果我在数据库中添加一个新的 openidconnect,我需要重置服务器,因为注册是在启动应用程序中..
是否可以动态地做到这一点? 他们可以帮助我吗?
【问题讨论】:
标签: azure-active-directory identityserver4 multi-tenant