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

如何将Azure AD B2C登录表单的signInName(邮箱地址)设为只读

实现方案

你只需要对你现有的技术配置文件做调整,即可实现预填充的邮箱只读,操作如下:

1. 核心修改

给OutputClaims中的signInName节点添加ReadOnly="true"属性,该属性会告知自断言页面渲染该字段时禁用编辑功能。
如果上述配置不生效,可在Metadata节点新增一项配置,强制覆盖全局的字段输入类型配置,避免全局signInName声明的UserInputType定义影响当前页面。

修改完成后的完整技术配置文件如下:

<TechnicalProfile Id="LocalAccountSigninWithReadOnlyEmail">
  <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="setting.showSignupLink">false</Item>
    <Item Key="SignUpTarget">SignUpWithLogonEmailExchange</Item>
    <Item Key="setting.operatingMode">Email</Item>
    <Item Key="ContentDefinitionReferenceId">api.selfasserted</Item>
    <!-- 可选配置,强制signInName字段为只读 -->
    <Item Key="UserInputType.signInName">Readonly</Item>
  </Metadata>
  <IncludeInSso>false</IncludeInSso>
  <InputClaims>
    <InputClaim ClaimTypeReferenceId="email" Required="true" PartnerClaimType="signInName" />
  </InputClaims>
  <OutputClaims>
    <!-- 新增ReadOnly属性禁用编辑 -->
    <OutputClaim ClaimTypeReferenceId="signInName" Required="true" ReadOnly="true" />
    <OutputClaim ClaimTypeReferenceId="password" Required="true" />
    <OutputClaim ClaimTypeReferenceId="objectId" />
    <OutputClaim ClaimTypeReferenceId="authenticationSource" />
  </OutputClaims>
  <OutputClaimsTransformations>
    <OutputClaimsTransformation ReferenceId="CopySignInNameToReadOnly" />
  </OutputClaimsTransformations>
  <ValidationTechnicalProfiles>
    <ValidationTechnicalProfile ReferenceId="login-NonInteractive" />
  </ValidationTechnicalProfiles>
  <UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />
</TechnicalProfile>

补充说明

该配置只会作用于当前技术配置文件对应的页面,不会影响其他流程中邮箱输入框的编辑权限,预填充的邮箱值会被固定,用户无法修改,也就无法将邀请绑定到其他账号。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.05 03:12:03