字段不会显示在 Azure AD B2C 自定义策略中

Field Won't Show in Azure AD B2C Custom Policy

以下字段不会显示在我的登录页面上,为什么?

TrustFrameworkExtensions.xml

<ClaimType Id="extension_AssociateID">
    <DisplayName>Associate ID - associateId</DisplayName>
    <DataType>string</DataType>
    <DefaultPartnerClaimTypes>
        <Protocol Name="OAuth2" PartnerClaimType="associateId" />
        <Protocol Name="OpenIdConnect" PartnerClaimType="associateId" />
    </DefaultPartnerClaimTypes>
    <UserInputType>Readonly</UserInputType>
</ClaimType>

我已将其添加到我的技术资料中

...
<InputClaim ClaimTypeReferenceId="extension_AssociateID" />
...
<OutputClaim ClaimTypeReferenceId="extension_AssociateID" Required="true"/>

为了调试它,我添加了一堆变体,它们都能正常工作。

标签是 {id after extension} - {PartnetClaimType}

我认输并决定使用 associate_id 字段名称,尽管这不是我想要的,然后 associate_id 也停止工作了。这引导我进行修复。

修复方法是将其从我的 OutputClaims 的技术配置文件 AAD-UserWriteUsingLogonName

中删除
<TechnicalProfile Id="AAD-UserWriteUsingLogonName">
    <Metadata>
        <Item Key="Operation">Write</Item>
        <Item Key="RaiseErrorIfClaimsPrincipalAlreadyExists">true</Item>
    </Metadata>
    <InputClaims>
        <InputClaim ClaimTypeReferenceId="signInName" PartnerClaimType="signInNames.userName" Required="true" />
    </InputClaims>
    <PersistedClaims>
        <PersistedClaim ClaimTypeReferenceId="signInName" PartnerClaimType="signInNames.userName" />
        <PersistedClaim ClaimTypeReferenceId="email" PartnerClaimType="strongAuthenticationEmailAddress" />
        <PersistedClaim ClaimTypeReferenceId="newPassword" PartnerClaimType="password" />
        <PersistedClaim ClaimTypeReferenceId="displayName" DefaultValue="DoNotUse" />
        <PersistedClaim ClaimTypeReferenceId="extension_associate_id" />
        <PersistedClaim ClaimTypeReferenceId="extension_organization_id" />
    </PersistedClaims>
    <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="objectId" />
        <OutputClaim ClaimTypeReferenceId="newUser" PartnerClaimType="newClaimsPrincipalCreated" />
        <OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="localAccountAuthentication" />
        <OutputClaim ClaimTypeReferenceId="userPrincipalName" />
        <!-- <OutputClaim ClaimTypeReferenceId="extension_associate_id" /> --> 
    </OutputClaims>
    <IncludeTechnicalProfile ReferenceId="AAD-Common" />
    <UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />
</TechnicalProfile>