【问题标题】:In B2C, how to change the MFA phone number or email or even change the method在 B2C 中,如何更改 MFA 电话号码或电子邮件甚至更改方法
【发布时间】:2021-02-16 01:16:58
【问题描述】:

我正在使用这个custom policy - “B2C IEF 自定义策略 - 使用 MFA 方法选择(电话/电子邮件)登录”。这很好用。

简介说“能够通过个人资料编辑更改此偏好”,但我在政策中没有看到这一点?

我的用例是用户可以更改 MFA 的电话号码或电子邮件地址,或者就 MFA 在两者之间切换(例如,将电话更改为电子邮件,反之亦然)。

最简单的方法是“重置”MFA 并要求用户再次启用 MFA。

所以我将“extension_mfaByPhoneOrEmail”设置为“重置”,然后政策说:

<!-- If user is enrolled for MFA, ask the user to select the preferred method -->
                <OrchestrationStep Order="4" Type="ClaimsExchange">
                    <Preconditions>
                    <!-- If the preferred MFA method is 'phone' skip this orchestration step -->
                        <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
                            <Value>extension_mfaByPhoneOrEmail</Value>
                            <Value>phone</Value>
                            <Action>SkipThisOrchestrationStep</Action>
                        </Precondition>
                        <!-- If the preferred MFA method is 'email' skip this orchestration step -->
                        <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
                            <Value>extension_mfaByPhoneOrEmail</Value>
                            <Value>email</Value>
                            <Action>SkipThisOrchestrationStep</Action>
                        </Precondition>
                        
                    </Preconditions>
                    <ClaimsExchanges>
                        <ClaimsExchange Id="SelfAsserted-Select-MFA-Method" TechnicalProfileReferenceId="SelfAsserted-Select-MFA-Method"/>
                    </ClaimsExchanges>
                </OrchestrationStep>

但我从来没有看到“extension_mfaByPhoneOrEmail”单选按钮。

我还需要“重置”其他属性吗?

例如该策略使用“newPhoneNumberEntered”和“isActiveMFASession”?

或者有没有更好的方法来“重置”MFA?

更新

我最终通过deletingextension_mfaByPhoneOrEmail 声明解决了这个问题。

然后用户可以选择再次选择电子邮件或电话进行 MFA。

但如果用户已经在使用电话,它会显示“我们有一部电话记录在案”并且无法更改。

我通过使用“编辑 MFA”sample 解决了这个问题。

有什么办法可以清除电话号码?

此声明是您无法通过 DelateClaims 方法删除的声明之一。

更新 2

我包含了 DeleteClaims 和包含此内容的用户旅程部分。

如果您仍有问题,请尝试将“SelfAsserted-Select-MFA-Method”中的“extension_mfaByPhoneOrEmail”检查注释掉。

<TechnicalProfile Id="AAD-DeleteClaimsUsingObjectId">
    <Metadata>
        <Item Key="Operation">DeleteClaims</Item>
    </Metadata>
    <InputClaims>
        <InputClaim ClaimTypeReferenceId="objectId" Required="true"/>
    </InputClaims>
    <PersistedClaims>
        <PersistedClaim ClaimTypeReferenceId="objectId"/>
        <PersistedClaim ClaimTypeReferenceId="extension_mfaByPhoneOrEmail"/>
        <PersistedClaim ClaimTypeReferenceId="Verified.strongAuthenticationPhoneNumber" PartnerClaimType="strongAuthenticationPhoneNumber"/>
    </PersistedClaims>
    <OutputClaims/>
    <IncludeTechnicalProfile ReferenceId="AAD-Common"/>
</TechnicalProfile>

<OrchestrationStep Order="3" Type="ClaimsExchange">
    <ClaimsExchanges>
        <ClaimsExchange Id="B2CUserProfileDeleteExchange" TechnicalProfileReferenceId="AAD-DeleteClaimsUsingObjectId"/>
    </ClaimsExchanges>
</OrchestrationStep>

<OrchestrationStep Order="4" Type="ClaimsExchange">
    <ClaimsExchanges>
        <ClaimsExchange Id="B2CUserProfileUpdateExchange" TechnicalProfileReferenceId="AAD-UserWriteProfileUsingObjectId"/>
    </ClaimsExchanges>
</OrchestrationStep>

<!-- This step reads any user attributes that we may not have received when authenticating using ESTS so they can be sent 
          in the token. -->
<OrchestrationStep Order="5" Type="ClaimsExchange">
    <Preconditions>
        <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
            <Value>authenticationSource</Value>
            <Value>socialIdpAuthentication</Value>
            <Action>SkipThisOrchestrationStep</Action>
        </Precondition>
    </Preconditions>
    <ClaimsExchanges>
        <ClaimsExchange Id="AADUserReadWithObjectId" TechnicalProfileReferenceId="AAD-UserReadUsingObjectId"/>
    </ClaimsExchanges>
</OrchestrationStep>


<!-- If user is enrolled for MFA, ask the user to change the preferred method or the email or phone number -->
<OrchestrationStep Order="6" Type="ClaimsExchange">
    <Preconditions>
        <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
            <Value>extension_mfaByPhoneOrEmail</Value>
            <Action>SkipThisOrchestrationStep</Action>
        </Precondition>
    </Preconditions>
    <ClaimsExchanges>
        <ClaimsExchange Id="SelfAsserted-Select-MFA-Method" TechnicalProfileReferenceId="SelfAsserted-Select-MFA-Method"/>
    </ClaimsExchanges>
</OrchestrationStep>

【问题讨论】:

  • 嗨,我也面临同样的问题。您能否分享您在自定义策略中所做的更改以使其发挥作用?我从过去 2 天开始摸不着头脑以使其发挥作用。它适用于新用户,问题只是在重置 MFA 时,提前感谢
  • 完成 - 如上所述。

标签: azure-ad-b2c


【解决方案1】:

在您的配置文件编辑技术配置文件中添加extension_mfaByPhoneOrEmail 作为输出声明。入门包使用名为 SelfAsserted-ProfileUpdate 的技术配置文件。

https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack/blob/master/SocialAndLocalAccountsWithMfa/TrustFrameworkBase.xml#L909

然后通过添加extension_mfaByPhoneOrEmail 作为技术配置文件AAD-UserWriteProfileUsingObjectId 的持久声明将属性保存到目录。

https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack/blob/master/SocialAndLocalAccountsWithMfa/TrustFrameworkBase.xml#L796

您可以在此处阅读有关 SelfAsserted 技术配置文件的输出声明: https://docs.microsoft.com/en-us/azure/active-directory-b2c/self-asserted-technical-profile#output-claims

您可以在此处阅读有关使用 Azure AD 技术配置文件将数据持久保存到目录的信息:https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-technical-profile

【讨论】:

    猜你喜欢
    • 2019-10-20
    • 1970-01-01
    • 2021-04-24
    • 1970-01-01
    • 1970-01-01
    • 2017-10-08
    • 1970-01-01
    • 2018-10-18
    • 2018-02-08
    相关资源
    最近更新 更多