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

Azure AD B2C登录UI未渲染新增TextBox类型字段field3的问题求助

解决SelfAsserted登录UI不渲染自定义字段的问题

我来帮你搞定这个问题!你遇到的情况是典型的SelfAsserted技术配置中输入字段声明缺失导致的——系统知道field3是必填项,但不知道要在UI上渲染它的输入框。

问题根源

SelfAssertedAttributeProvider的逻辑是这样的:

  • InputClaims:定义需要用户在界面上手动输入的字段,只有在这里声明的Claim才会被渲染成对应的UI控件
  • OutputClaims:定义这个技术配置最终要输出的声明集合(包含用户输入的字段和后续流程生成的字段)

你之前只在OutputClaims里标记了field3为必填,所以系统会执行必填校验,但因为没在InputClaims中声明,UI层不知道要渲染这个字段的输入框。

修复方案

只需要把field3添加到InputClaims节点中即可,修改后的完整TechnicalProfile配置如下:

<TechnicalProfile Id="SelfAsserted-LocalAccountSignin-Email">
    <DisplayName>Local Account Signin</DisplayName>
    <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
    <Metadata>
        <Item Key="SignUpTarget">SignUpWithLogonEmailExchange</Item>
        <Item Key="setting.operatingMode">Email</Item>
        <Item Key="setting.showSignupLink">False</Item>
        <Item Key="setting.forgotPasswordLinkLocation">False</Item>
    </Metadata>
    <IncludeInSso>false</IncludeInSso>
    <InputClaims>
        <InputClaim ClaimTypeReferenceId="signInName" />
        <!-- 新增这一行,让field3在登录UI中显示为文本输入框 -->
        <InputClaim ClaimTypeReferenceId="field3" />
    </InputClaims>
    <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="signInName" Required="true" />
        <OutputClaim ClaimTypeReferenceId="password" Required="true" />
        <OutputClaim ClaimTypeReferenceId="field3" Required="true" />
    </OutputClaims>
    <ValidationTechnicalProfiles>
        <ValidationTechnicalProfile ReferenceId="login-NonInteractive" />
    </ValidationTechnicalProfiles>
    <UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />
</TechnicalProfile>

额外说明

  • 你现有的ClaimType配置是正确的(TextBox类型、string数据类型),不需要修改
  • 如果需要调整字段在UI上的显示顺序,直接调整InputClaims中的字段顺序即可,SelfAsserted会按照这个顺序渲染输入控件
  • 若后续需要隐藏某个字段,可以在Metadata中添加<Item Key="setting.showClaim.field3">False</Item>来控制

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.28 15:37:31