Azure Ad B2C 配置文件编辑无法删除声明

Azure Ad B2C Profile Edit Can't Delete Claim

我 运行 遇到一个问题,即我的用户登录到个人资料编辑页面并删除一些不需要的声明的值。

例如...

如果 Claim giveName 的值为“Test”并且用户将其删除,则该值现在将为“”或 string.empty。

但是,当旅程完成时,RP 仍将原始值“Test”传递回应用程序,并且也没有将“”空字符串持久保存到 Azure AD。

相关技术资料如下:

<TechnicalProfile Id="UpdateConsumerInformation">
          <DisplayName>Business Information</DisplayName>
          <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
          <Metadata>
            <Item Key="ContentDefinitionReferenceId">api.selfasserted.profileupdate</Item>
            <Item Key="language.button_continue">Continue</Item>
          </Metadata>
          <InputClaims>
            <InputClaim ClaimTypeReferenceId="givenName" />
            <InputClaim ClaimTypeReferenceId="surName" />
            <InputClaim ClaimTypeReferenceId="extension_Company" />
            <InputClaim ClaimTypeReferenceId="streetAddress" />
            <InputClaim ClaimTypeReferenceId="extension_streetAddress2" />
            <InputClaim ClaimTypeReferenceId="city" />
            <InputClaim ClaimTypeReferenceId="state" />
            <InputClaim ClaimTypeReferenceId="postalCode" />
            <InputClaim ClaimTypeReferenceId="country" />
            <InputClaim ClaimTypeReferenceId="extension_Company" />
            <InputClaim ClaimTypeReferenceId="extension_Phone" />
            <InputClaim ClaimTypeReferenceId="extension_Consent" />
          </InputClaims>
          <OutputClaims>
            <OutputClaim ClaimTypeReferenceId="givenName" Required="true" />
            <OutputClaim ClaimTypeReferenceId="surName" Required="true" />
            <OutputClaim ClaimTypeReferenceId="extension_Company" Required="false" />
            <OutputClaim ClaimTypeReferenceId="streetAddress" />
            <OutputClaim ClaimTypeReferenceId="extension_streetAddress2" />
            <OutputClaim ClaimTypeReferenceId="city" />
            <OutputClaim ClaimTypeReferenceId="state" />
            <OutputClaim ClaimTypeReferenceId="postalCode" />
            <OutputClaim ClaimTypeReferenceId="country" Required="true" />
            <OutputClaim ClaimTypeReferenceId="extension_Phone" />
            <OutputClaim ClaimTypeReferenceId="extension_Consent" Required="true" />
          </OutputClaims>
          <ValidationTechnicalProfiles>
            <ValidationTechnicalProfile ReferenceId="WriteConsumerInformation" />
          </ValidationTechnicalProfiles>
        </TechnicalProfile>
        <TechnicalProfile Id="WriteConsumerInformation">
          <DisplayName>Customer Information</DisplayName>
          <Metadata>
            <Item Key="Operation">Write</Item>
            <Item Key="RaiseErrorIfClaimsPrincipalAlreadyExists">false</Item>
          </Metadata>
          <IncludeInSso>false</IncludeInSso>
          <InputClaimsTransformations>
            <InputClaimsTransformation ReferenceId="CreateDisplayNameFromFirstNameAndLastName" />
          </InputClaimsTransformations>
          <InputClaims>
            <InputClaim ClaimTypeReferenceId="signInName" PartnerClaimType="signInNames.emailAddress" Required="true" />
          </InputClaims>
          <PersistedClaims>
            <PersistedClaim ClaimTypeReferenceId="signInName" PartnerClaimType="signInNames.emailAddress" />
            <PersistedClaim ClaimTypeReferenceId="displayName" DefaultValue="unknown" />
            <PersistedClaim ClaimTypeReferenceId="givenName" />
            <PersistedClaim ClaimTypeReferenceId="surName" />
            <PersistedClaim ClaimTypeReferenceId="streetAddress" />
            <PersistedClaim ClaimTypeReferenceId="extension_streetAddress2" />
            <PersistedClaim ClaimTypeReferenceId="city" />
            <PersistedClaim ClaimTypeReferenceId="state" />
            <PersistedClaim ClaimTypeReferenceId="postalCode" />
            <PersistedClaim ClaimTypeReferenceId="country" />
            <PersistedClaim ClaimTypeReferenceId="extension_Consent" />
            <PersistedClaim ClaimTypeReferenceId="extension_Company" />
            <PersistedClaim ClaimTypeReferenceId="extension_Phone" />
          </PersistedClaims>
          <IncludeTechnicalProfile ReferenceId="AAD-Common" />
        </TechnicalProfile>

我期望的是,如果用户要清除其中一项声明的内容,该声明将在 azure ad b2c 中被清除,并且 RP 不会 return 原始值。

在“UpdateConsumerInformation”TechnicalProfile 中使用 AllowGenerationOfClaimsWithNullValues 元数据项。

<TechnicalProfile Id="UpdateConsumerInformation">
          ...
          <Metadata>
            <Item Key="AllowGenerationOfClaimsWithNullValues">true</Item>
            <Item Key="ContentDefinitionReferenceId">api.selfasserted.profileupdate</Item>
            <Item Key="language.button_continue">Continue</Item>
          </Metadata>
          <InputClaims>
            ...
          </InputClaims>
          <OutputClaims>
            ...
          </OutputClaims>
    <ValidationTechnicalProfiles>
        <ValidationTechnicalProfile ReferenceId="WriteConsumerInformation" />
    </ValidationTechnicalProfiles>
</TechnicalProfile>