Azure B2C 自定义策略条件业务流程步骤



我正在尝试根据自定义属性的值引入新的业务流程步骤。我的要求是,仅当 myattribute(布尔属性(的值设置为 true 时,我才想执行业务流程步骤。myattribute 的值设置为 true 或 false。 我正在做这样的事情。

<Precondition Type="ClaimEquals" ExecuteActionsIf="true">
<Value>False</Value>
<Value>extension_myattribute</Value>
<Action>SkipThisOrchestrationStep</Action>
</Precondition>

但是,无论 myattribute 的值如何,都不会跳过此步骤。我添加了myattribute作为AAD-UserReadUsingObjectId的OutPutClaims的一部分。我能够在 C# 中看到extension_myattribute的值。

任何指向比较价值的示例的指针都会对我有很大帮助。

对于ClaimEquals前提条件,第一个<Value />必须设置为声明类型,第二个<Value />必须设置为声明值:

<Precondition Type="ClaimEquals" ExecuteActionsIf="true">
<Value>extension_myattribute</Value>
<Value>False</Value>
<Action>SkipThisOrchestrationStep</Action>
</Precondition>

对于布尔声明,可能的值为"真"和"假"。

你尝试做的事情应该有效,至少在入门包中有非常相似的例子。

https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack/blob/f376b431dc0c7353faf52632d3d3f735ad5978a1/scenarios/source/aadb2c-ief-terms-of-use/SignUpOrSigninToUDateTime.xml

<!-- Check if the user has selected to sign in using one of the social providers -->
<OrchestrationStep Order="2" Type="ClaimsExchange">
<Preconditions>
<Precondition Type="ClaimEquals" ExecuteActionsIf="false">
<Value>authenticationSource</Value>
<Value>socialIdpAuthentication</Value>
<Action>SkipThisOrchestrationStep</Action>
</Precondition>
</Preconditions>
<ClaimsExchanges>
<ClaimsExchange Id="FacebookExchange" TechnicalProfileReferenceId="Facebook-OAUTH" />
<ClaimsExchange Id="SignUpWithLogonEmailExchange" TechnicalProfileReferenceId="SelfAsserted-Input-ToU-LocalAccountSignUp" />
</ClaimsExchanges>
</OrchestrationStep>

xsd 还明确提到了"真"和"假">

<xs:attribute use="required" name="ExecuteActionsIf" type="xs:boolean" >
<xs:annotation>
<xs:documentation>
Specifies if the actions in this precondition should be performed if the test is true or false.
</xs:documentation>
</xs:annotation>
</xs:attribute>

也许您的索赔实际上尚未确定?还是您混合了吸引力和索赔?

最新更新