首页 > 解决方案 > Azure B2C 前提条件和检查空字符串

问题描述

有没有办法在编排步骤的前提条件步骤中检查声明是否设置为空字符串?

我已经尝试了以下方法,但它不起作用,它永远不会执行 SkipThisOrchestrationStep

              <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
                <Value>readOnlyPhone</Value>
                <Value></Value>
                <Action>SkipThisOrchestrationStep</Action>
              </Precondition>
            </Preconditions>

此外,我也尝试使用 ClaimExists 但这也不起作用

            <Preconditions>
              <Precondition Type="ClaimsExists" ExecuteActionsIf="false">
                <Value>readOnlyPhone</Value>
                <Action>SkipThisOrchestrationStep</Action>
              </Precondition>
            </Preconditions>

背景,声明是由 RestfulProvider Technical Profile 设置的,API 将在有效负载中返回"phoneNumber": ""

标签: azure-ad-b2cazure-ad-b2c-custom-policy

解决方案


使用比较声明转换返回布尔值 h​​ttps ://docs.microsoft.com/en-us/azure/active-directory-b2c/string-transformations#compareclaimtovalue

然后对这个布尔值使用 claimEqual 前提条件。


推荐阅读