我的 Angular .net core 2.0 应用程序使用 oauth2.0 身份验证,并且我在startup.cs 中配置了相同的身份验证。 PFB代码
services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddCookie()
.AddOpenIdConnect(options =>
{
options.ClientId = azureAdConfig.ClientId;
options.ClientSecret = azureAdConfig.ClientSecret;
options.Authority = string.Format(azureAdConfig.AADInstance, azureAdConfig.Tenant);
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.Resource = azureAdConfig.ResourceURI_Graph;
options.Events = new AuthEvents(azureAdConfig, connectionStringsConfig);
});
应用程序工作正常,但现在我想限制应用程序由一组用户使用。我已在 Azure AD 应用程序中添加了所需的用户和组。
然后我在 azure 应用程序服务中启用了以下设置。
此外,我还在 Azure AD 企业应用程序中启用了需要用户分配设置。全氟硼酸
但是现在,当我访问该应用程序时,我收到以下错误:(我已添加所需的回复网址)
最佳答案
由于您使用 OpenID Connect 从 AAD 登录用户,因此在 Web 应用程序中使用 ASP.Net OpenID Connect OWIN 中间件,因此无需配置 built-in authentication and authorization support of App Service 。
尝试禁用 AAD 应用的身份验证和授权
功能,启用 AAD 应用的需要用户分配
,并让应用程序中的 OIDC 中间件控制身份验证过程。
关于.net - 如何将 Azure 应用服务的访问权限限制为仅在 Azure Ad 的用户和组设置中添加的用户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57913244/