【问题标题】:How to Authorize a Scheduled Task with a B2C protected Web API?如何使用受 B2C 保护的 Web API 授权计划任务?
【发布时间】:2019-01-31 16:33:27
【问题描述】:

我在 Azure 上托管了一个受 B2C 保护的 Web API。 我需要创建一个需要从 Web Api 消耗资源的计划任务(或 Web 服务)。 让计划任务通过 Web Api 进行身份验证的推荐方法是什么?

我认为我不能在这种情况下使用 B2C。我正在考虑使用密钥,但我不太清楚如何在 Azure 中进行设置,以及如何更新 Web Api OWIN 中间件以处理 B2C 和密钥身份验证。

这是我当前的 Startup.Auth:

    public void ConfigureAuth(IAppBuilder app)
    {
        TokenValidationParameters tvps = new TokenValidationParameters
        {
            // Accept only those tokens where the audience of the token is equal to the client ID of this app
            ValidAudience = ClientId,
            AuthenticationType = Startup.DefaultPolicy
        };
        app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions
        {
            // This SecurityTokenProvider fetches the Azure AD B2C metadata & signing keys from the OpenIDConnect metadata endpoint
            AccessTokenFormat = new JwtFormat(tvps, new OpenIdConnectCachingSecurityTokenProvider(String.Format(AadInstance, Tenant, DefaultPolicy)))
        });
    }

干杯!

【问题讨论】:

    标签: authorization scheduled-tasks azure-ad-b2c


    【解决方案1】:

    您可以使用资源所有者密码凭据(ROPC)用户流程

    https://docs.microsoft.com/en-us/azure/active-directory-b2c/configure-ropc

    【讨论】:

      猜你喜欢
      • 2014-10-17
      • 2019-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-22
      • 2017-01-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多