【发布时间】:2020-07-09 14:47:25
【问题描述】:
我有一个使用 Azure AD 的 ASP.NET WEB API Core 3.1 应用程序。 我使用 Microsoft.Identity.Web 库。 我是这样设置的:
public void ConfigureServices(IServiceCollection services)
{
Trace.TraceInformation("Configuring services");
services.AddProtectedWebApi(Configuration, subscribeToJwtBearerMiddlewareDiagnosticsEvents: true
)
.AddProtectedWebApiCallsProtectedWebApi(Configuration)
.AddInMemoryTokenCaches();
services.AddAuthentication(AzureADDefaults.BearerAuthenticationScheme)
.AddAzureADBearer(options => Configuration.Bind("AzureAd", options));
.......
}
我的应用程序是多租户的,所以我需要取消验证观众。 最近我将该库用作一个单独的项目,因此我可以在其源代码中对其进行更改:
ValidateIssuer = false
但目前我使用的是 nuget 的库,所以我不能简单地更改源代码以避免验证受众(发行者)。
我应该如何配置库来实现它?
【问题讨论】:
标签: asp.net-web-api azure-active-directory