【问题标题】:Unable to configure multi tenant Azure ad with Identity server 4无法使用身份服务器 4 配置多租户 Azure 广告
【发布时间】:2022-08-15 21:50:01
【问题描述】:
我正在使用 Flutter 移动应用程序并使用身份服务器 4。现在我需要使用身份服务器配置 Azure Ad。在我们的场景中,我们有不同的客户拥有自己的天蓝色广告设置,并且我们有一个通用的登录页面。
现在,我如何为不同的组织配置多个带有身份服务器的 Azure 广告,因为每个组织都有自己的 AAD 设置。
如果有人可以分享有关我们如何使用 Flutter 应用程序执行此操作的工作流程详细信息,那就太好了。
标签:
flutter
.net-core
azure-active-directory
identityserver4
multi-tenant
【解决方案1】:
• 您当然可以通过添加适当的Identity Server 4 中 Azure AD 的身份验证处理程序如下。请做确保应用程序已在身份服务器 4 的客户端 Azure AD 中注册,重定向 URI 为“http://localhost:5000/signin-aad”(您可以在“ConfigureServices”的“Startup”类中找到它Identity Server 4 门户中的方法).请输入所需的详细信息在下面提到的 Azure AD 身份验证处理程序中注册的应用程序,即应用程序 ID、租户 ID 等并相应地在 Identity Server 4 中更新它:-
services.AddAuthentication()
.AddOpenIdConnect("aad", "Azure AD", options =>
{
options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
options.SignOutScheme = IdentityServerConstants.SignoutScheme;
options.Authority = "https://login.windows.net/<Directory (tenant) ID>";
options.ClientId = "<Your Application (client) ID>";
options.ResponseType = OpenIdConnectResponseType.IdToken;
options.CallbackPath = "/signin-aad";
options.SignedOutCallbackPath = "/signout-callback-aad";
options.RemoteSignOutPath = "/signout-aad";
options.TokenValidationParameters = new TokenValidationParameters
{
NameClaimType = "name",
RoleClaimType = "role"
};
});
请找到以下应用程序注册详细信息快照供您参考。完成后,您将能够看到‘蔚蓝广告’您的登录选项卡外部登录部分下的 Identity Server 4 登录门户.通过此选项,来自您客户端的注册 Azure AD 用户将能够使用 Azure AD 凭据登录到 Identity Server 4:-
请确保基本上认为Identity Server 4 在 ASP .Net Core 构建版本上配置。因此,相应的身份验证处理程序。同样,您可以在 Identity Server 4 中为多个 Azure AD 租户配置多个身份验证处理程序,并确保为每个租户启用外部身份登录.请找到以下链接以获取更多信息:-
https://www.ashleyhollis.com/how-to-configure-azure-active-directory-with-identityserver4