You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在特定用户旅程中隐藏本地登录视图?(基于自定义SignUpSignIn策略)

实现仅展示注册选项、社交IDP及「立即注册」链接的用户旅程

嘿,这个需求我之前刚好帮客户处理过,核心思路是复制并修改现有SignUpSignIn用户旅程,同时自定义页面UI隐藏本地登录选项,下面是具体步骤:

1. 复制并重命名用户旅程

打开你的TrustFrameworkExtensions.xml,找到默认的<UserJourney Id="SignUpOrSignIn">节点,完整复制一份,然后把新的用户旅程ID改成专属名称,比如SignUpOnlyWithSocial。

2. 修改用户旅程的编排步骤

在新的用户旅程里,调整第一步的CombinedSignInAndSignUp步骤:

  • 移除本地账户登录的ClaimsProviderSelection(也就是指向LocalAccountSigninEmailExchange的那一行),这样本地登录选项就不会显示了
  • 保留所有社交IDP的ClaimsProviderSelection,确保社交登录按钮正常展示
  • (可选)如果需要自定义页面,替换ContentDefinitionReferenceId为我们后面创建的自定义页面ID

修改后的第一步示例:

<OrchestrationStep Order="1" Type="CombinedSignInAndSignUp" ContentDefinitionReferenceId="api.signuponlywithsocial">
  <ClaimsProviderSelections>
    <!-- 保留你的社交IDP,比如Facebook、Google等 -->
    <ClaimsProviderSelection TargetClaimsExchangeId="FacebookExchange" />
    <ClaimsProviderSelection TargetClaimsExchangeId="GoogleExchange" />
  </ClaimsProviderSelections>
  <!-- 移除本地登录的ClaimsExchange -->
</OrchestrationStep>

3. 创建自定义ContentDefinition隐藏本地登录

默认的api.signuporsignin页面会显示登录表单,我们可以创建一个自定义页面配置,强制隐藏本地登录并显示注册链接:

在TrustFrameworkExtensions.xml的<ContentDefinitions>节点下添加:

<ContentDefinition Id="api.signuponlywithsocial">
  <LoadUri>~/tenant/templates/AzureBlue/unified.cshtml</LoadUri>
  <RecoveryUri>~/common/default_page_error.html</RecoveryUri>
  <DataUri>urn:com:microsoft:aad:b2c:elements:unifiedssp:1.1.0</DataUri>
  <Metadata>
    <Item Key="DisplayName">Sign Up Only with Social</Item>
    <Item Key="showSignupLink">true</Item> <!-- 显示「立即注册」链接 -->
    <Item Key="showLocalAccountSignin">false</Item> <!-- 隐藏本地账户登录表单 -->
  </Metadata>
</ContentDefinition>

4. 确保注册流程正常衔接

在新用户旅程的后续编排步骤里,保留本地注册的ClaimsExchange,这样用户点击「立即注册」时能正常进入注册页面:

<OrchestrationStep Order="2" Type="ClaimsExchange">
  <Preconditions>
    <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
      <Value>objectId</Value>
      <Action>SkipThisOrchestrationStep</Action>
    </Precondition>
  </Preconditions>
  <ClaimsExchanges>
    <ClaimsExchange Id="SignUpWithLogonEmailExchange" TechnicalProfileReferenceId="LocalAccountSignUpWithLogonEmail" />
  </ClaimsExchanges>
</OrchestrationStep>

5. 更新Relying Party文件

打开你的依赖方文件(比如SignUpSignIn.xml),把<DefaultUserJourney ReferenceId="SignUpOrSignIn" />改成我们新创建的用户旅程ID:

<RelyingParty>
  <DefaultUserJourney ReferenceId="SignUpOnlyWithSocial" />
  <!-- 其他原有配置保持不变 -->
</RelyingParty>

测试验证

部署修改后的策略后,访问登录页面应该只会看到:

  • 所有配置好的社交IDP登录按钮
  • 「立即注册」链接
  • 完全看不到本地账户登录的表单

内容的提问来源于stack exchange,提问作者Lucky

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 07:03:45