【问题标题】:.Net Core and Azure AD B2C Setup.Net Core 和 Azure AD B2C 设置
【发布时间】:2018-02-15 20:00:29
【问题描述】:

是否有在 .Net Core 中设置 Azure AD B2C 的教程或设置指南? official documentation提供的sample code很陈旧,没有太多解释。

【问题讨论】:

    标签: azure authentication .net-core azure-ad-b2c


    【解决方案1】:

    您无需在 ASP.NET 核心应用程序上进行配置。主要部分(除了配置您的 AAD B2C)是添加/设置身份验证中间件以使用 jwt 承载并将您的租户/策略传递给它。

    Tutorial link

    示例配置(取自教程):

    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
        };
      });
    

    【讨论】:

      【解决方案2】:

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-05-30
        • 2021-10-31
        • 1970-01-01
        • 2023-03-06
        • 2018-01-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多