是否有在.Net Core中设置Azure AD B2C的教程或设置指南? sample code提供的official documentation已过时且无法解释。
答案 0 :(得分:2)
您必须在ASP.NET核心应用程序上配置mutch。主要部分(配置您的AAD B2C)是添加/设置身份验证中间件以使用jwt承载并将您的租户/策略传递给它。
示例配置(摘自教程):
services.AddAuthentication(options =>
{
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(jwtOptions =>
{
jwtOptions.Authority = $"https://login.microsoftonline.com/tfp/{Configuration["AzureAdB2C:Tenant"]}/{Configuration["AzureAdB2C:Policy"]}/v2.0/";
jwtOptions.Audience = Configuration["AzureAdB2C:ClientId"];
jwtOptions.Events = new JwtBearerEvents
{
OnAuthenticationFailed = AuthenticationFailed
};
});
答案 1 :(得分:1)
Microsoft刚刚在ASP.NET Core上发布了一些新文档: