1

我有如下要求。

我必须在 azure b2c 中创建 3 个应用程序。我必须创建 3 个不同的自定义登录策略。在每个自定义登录策略中,我必须调用不同的 rest api 进行登录而不是输入验证。我的用户存储在 B2C 之外(用户存储在 sql server 中)。所以基本上这些rest api将检查并返回每个用户存储中是否存在用户。最后我必须将一个应用程序分配给一个自定义登录策略。应用 1 - 自定义登录策略 1 应用 2 - 自定义登录策略 2 应用 3 - 自定义登录策略 3

我将在我的客户端应用程序中使用 APPID、秘密、租户名称和自定义登录策略名称。当我从客户端应用程序点击登录/登录时,B2C 应该显示一个 UI 以获取用户名和密码。基于 appid,它必须调用自定义登录策略并验证用户名和密码。最后它必须将令牌返回给我的客户端应用程序。

任何帮助表示赞赏。

4

1 回答 1

0

我建议您将这些策略加入到 1 个文件中,然后:1)包括内容页面定义以供选择:

      <ContentDefinition Id="api.idpselections">
    <!--
        https://login.microsoftonline.com/static/tenant/default/idpSelector.cshtml
        https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-ui-customization-custom-dynamic
    -->
    <LoadUri>~/tenant/default/idpSelector.cshtml</LoadUri>
    <RecoveryUri>~/common/default_page_error.html</RecoveryUri>
    <DataUri>urn:com:microsoft:aad:b2c:elements:idpselection:1.0.0</DataUri>
    <Metadata>
      <Item Key="DisplayName">Login provider selection page</Item>
      <Item Key="language.intro">Select login provider:</Item>
    </Metadata>
  </ContentDefinition>

然后将您的旅程调整为以下内容:

<UserJourney Id="YourJourneyId">
  <OrchestrationSteps>
    <OrchestrationStep Order="1" Type="ClaimsProviderSelection" ContentDefinitionReferenceId="api.idpselections">
        <ClaimsProviderSelections>
            <ClaimsProviderSelection TargetClaimsExchangeId="LoginProvider1" />
            <ClaimsProviderSelection TargetClaimsExchangeId="LoginProvider2" />
        </ClaimsProviderSelections>
    </OrchestrationStep>
    <OrchestrationStep Order="2" Type="ClaimsExchange">
      <ClaimsExchanges>
        <ClaimsExchange Id="LoginProvider1" TechnicalProfileReferenceId="TechProfileForLogin1" />
        <ClaimsExchange Id="LoginProvider2" TechnicalProfileReferenceId="TechProfileForLogin2" />
      </ClaimsExchanges>
    </OrchestrationStep>
    <OrchestrationStep Order="3" Type="SendClaims" CpimIssuerTechnicalProfileReferenceId="YourIssuer" />
  </OrchestrationSteps>
  <ClientDefinition ReferenceId="DefaultWeb" />
</UserJourney>
于 2018-06-28T09:22:11.120 回答