Azure B2C自定义策略条件编排步骤

时间:2018-08-17 17:23:22

标签: azure azure-ad-b2c identity-experience-framework

我正在尝试根据我的自定义属性的值引入新的业务流程步骤。我的要求是,仅当myattribute(boolean attribute)的值设置为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的值。

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

2 个答案:

答案 0 :(得分:0)

您尝试做的事情应该可以起作用,至少在入门包中有非常相似的示例。

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还明确提及“ true”和“ false”

<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>

也许您的要求尚未真正确定?还是您要混合所有权和主张?

答案 1 :(得分:0)

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

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

对于布尔值声明,可能的值为“ True”和“ False”。