有没有办法在 Azure AD B2C 的密码重置流程中使用用户名而不是电子邮件?

Is there a way for use UserName instead of email in Password Reset flow in Azure AD B2C?

我正在使用自定义策略自定义 azure ad b2c 中的 PasswordReset 流程,但我找不到使用 UserName[=20= 的方法] 而不是 Email 来恢复密码。我尝试在技术资料 AAD-UserReadUsingEmailAddress 中使用输入 signInName 而不是电子邮件,但仍然在表单中显示电子邮件。

<TechnicalProfile Id="AAD-UserReadUsingEmailAddress">
          <Metadata>
            <Item Key="Operation">Read</Item>
            <Item Key="RaiseErrorIfClaimsPrincipalDoesNotExist">true</Item>
            <Item Key="UserMessageIfClaimsPrincipalDoesNotExist">An account could not be found for the provided user ID.</Item>
          </Metadata>
          <IncludeInSso>false</IncludeInSso>
          <InputClaims>
            <InputClaim ClaimTypeReferenceId="signInName" PartnerClaimType="signInNames.userName" Required="true" />
          </InputClaims>
          <OutputClaims>
            <!-- Required claims -->
            <OutputClaim ClaimTypeReferenceId="objectId" />
            <OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="localAccountAuthentication" />
  
            <!-- Optional claims -->
            <OutputClaim ClaimTypeReferenceId="userPrincipalName" />
            <OutputClaim ClaimTypeReferenceId="displayName" />
            <OutputClaim ClaimTypeReferenceId="accountEnabled" />
            <OutputClaim ClaimTypeReferenceId="otherMails" />
            <OutputClaim ClaimTypeReferenceId="signInNames.emailAddress" />
          </OutputClaims>
          <OutputClaimsTransformations>
            <OutputClaimsTransformation ReferenceId="AssertAccountEnabledIsTrue" />
          </OutputClaimsTransformations>
          <IncludeTechnicalProfile ReferenceId="AAD-Common" />
        </TechnicalProfile>

是否可以使用 userName 执行此操作?

此技术配置文件是读取帐户的实现。您想要实现的是首先显示用户名文本框。要在屏幕上显示某些内容,您需要修改 selfAsserted 技术配置文件。

关键是把运行模式改成Username in the selfAsserted technical profile which asks the user for their identifer (which from the starter pack is: LocalAccountDiscoveryUsingEmailAddress), the latest key name is setting.operatingMode, reference here,设置成username。然后文本框验证将用于用户名。

有一个完整的样本here, and you can quick deploy using this link