字段无法在Azure AD B2C自定义策略中显示

时间:2017-09-21 14:52:32

标签: azure-ad-b2c

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

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>

我已将其添加到我的TechnicalProfile

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

为了调试它,我添加了一些变体,它们都有效。

fields that do work

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

1 个答案:

答案 0 :(得分:0)

我尽量使用了associate_id字段名称,即使这不是我想要的,然后associate_id也停止了工作。这引导我解决问题。

修复方法是将其从我的TechnicalProfile 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>