Azure AD B2C 自定义登录策略显示 SignUpSignIn

Posted

技术标签:

【中文标题】Azure AD B2C 自定义登录策略显示 SignUpSignIn【英文标题】:Azure AD B2C Custom SignIn Policy Displays SignUpSignIn 【发布时间】:2019-11-14 07:27:38 【问题描述】:

我有一个自定义登录策略,因为我需要在登录过程中从应用程序数据库(通过 REST API)中获取一些东西。

所以我有这个用户旅程

<UserJourney Id="SignIn">
      <OrchestrationSteps>

        <OrchestrationStep Order="1" Type="CombinedSignInAndSignUp" ContentDefinitionReferenceId="api.localaccountsignin">
          <ClaimsProviderSelections>
            <ClaimsProviderSelection ValidationClaimsExchangeId="LocalAccountSigninEmailExchange" />
          </ClaimsProviderSelections>
          <ClaimsExchanges>
            <ClaimsExchange Id="LocalAccountSigninEmailExchange" TechnicalProfileReferenceId="SelfAsserted-LocalAccountSignin-Email" />
          </ClaimsExchanges>
        </OrchestrationStep>

        <OrchestrationStep Order="2" Type="ClaimsExchange">
          <ClaimsExchanges>
            <ClaimsExchange Id="AADUserReadWithObjectId" TechnicalProfileReferenceId="AAD-UserReadUsingObjectId" />
          </ClaimsExchanges>
        </OrchestrationStep>

        <OrchestrationStep Order="3" Type="ClaimsExchange">
          <ClaimsExchanges>
            <ClaimsExchange Id="GetCustomDbObj" TechnicalProfileReferenceId="GetCustomDbObj" />
          </ClaimsExchanges>
        </OrchestrationStep>

        <OrchestrationStep Order="4" Type="SendClaims" CpimIssuerTechnicalProfileReferenceId="JwtIssuer" />

      </OrchestrationSteps>
      <ClientDefinition ReferenceId="DefaultWeb" />
    </UserJourney>

您可以在第 3 步中看到,我引用了一个自定义技术配置文件,该配置文件从自定义 REST API 获取一些数据。

在第一步中,我显示(假设)登录页面,它引用api.localaccountsignin

<ContentDefinition Id="api.localaccountsignin">
        <LoadUri>https://mytenant.b2clogin.com/static/tenant/default/signin.cshtml</LoadUri>
        <RecoveryUri>https://mytenant.b2clogin.com/static/tenant/default/signin.cshtml</RecoveryUri>
        <DataUri>urn:com:microsoft:aad:b2c:elements:contract:unifiedssp:1.0.0</DataUri>
        <Metadata>
          <Item Key="TemplateId">azureBlue</Item>
        </Metadata>
      </ContentDefinition>

问题是当我使用策略时,我看到一个类似于注册+登录统一策略的页面

而不仅仅是我想要的登录策略。

我怀疑这与它有关

<OrchestrationStep Order="1" Type="CombinedSignInAndSignUp" ContentDefinitionReferenceId="api.localaccountsignin">

更具体地说,CombinedSignInAndSignUp 但我不知道该放什么。我尝试使用ClaimsExchange,但没有成功。

有解决办法吗?

【问题讨论】:

参考docs.microsoft.com/en-us/azure/active-directory-b2c/…。您可以根据自己的要求自定义更多内容。 【参考方案1】:

根据this:

您可以通过将 SignUp 设置为“False”来实现此目的。

<Item Key=”setting.showSignupLink”>False</Item>

【讨论】:

谢谢。有效。真的很难找到关于这些东西的文档......

以上是关于Azure AD B2C 自定义登录策略显示 SignUpSignIn的主要内容,如果未能解决你的问题,请参考以下文章

Azure AD B2C密码更改自定义策略,用户每次都需要登录

Azure AD B2C:自定义策略 - 登录不起作用

Azure AD B2C - 我们可以使用电子邮件 ID 而不是 UPN 登录 - 仅限本地帐户自定义策略吗?

Azure AD B2C 自定义密码重置策略不会使用 + char\sign 验证电子邮件

在 Cordova/Ionic 应用程序上登录 Azure AD B2C

Azure AD B2C 自定义策略 - Javascript