在azure ad b2c自定义策略中对验证技术资料进行事前评估

时间:2019-11-12 12:42:36

标签: azure-ad-b2c

我的技术档案中有3项输出声明。这三个之一是“ RadioSingleSelect”。根据为单选按钮选择的值,需要确定该技术档案是否有效的验证档案。以下是我的技术资料和创建的声明类型

     <ClaimType Id="IsVisible">
        <DisplayName>Is this visble?</DisplayName>
        <DataType>boolean</DataType>
        <UserInputType>RadioSingleSelect</UserInputType>
        <Restriction>
          <Enumeration Text="Yes" Value="true" SelectByDefault="false" />
          <Enumeration Text="No" Value="false" SelectByDefault="false" />
        </Restriction>
      </ClaimType>
    </ClaimsSchema>
<TechnicalProfile Id="Profile1">
    <DisplayName>Profile1</DisplayName>
    <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
    <Metadata>
        <Item Key="IpAddressClaimReferenceId">IpAddress</Item>
        <Item Key="ContentDefinitionReferenceId">api.localaccountsignup</Item>
        <Item Key="language.button_continue">Continue</Item>
        <Item Key="EnforceEmailVerification">False</Item>           
    </Metadata>
    <CryptographicKeys>
        <Key Id="issuer_secret" StorageReferenceId="B2C_1A_TokenSigningKeyContainer" />
    </CryptographicKeys>
    <InputClaims>
        <InputClaim ClaimTypeReferenceId="name" />
        <InputClaim ClaimTypeReferenceId="code" />
    </InputClaims>
    <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="name" Required="true" /> 
        <OutputClaim ClaimTypeReferenceId="verificationCode" Required="true" />
        <OutputClaim ClaimTypeReferenceId="IsVisible" />
    </OutputClaims>
    <ValidationTechnicalProfiles>
    <ValidationTechnicalProfile ReferenceId="CheckIsVisible">
        <Preconditions>
        <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
            <Value>IsVisible</Value>
            <Value>true</Value>
            <Action>SkipThisValidationTechnicalProfile</Action>
        </Precondition>
    </Preconditions>
    </ValidationTechnicalProfile>
    </ValidationTechnicalProfiles>
    <UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />
</TechnicalProfile>

我的预期输出是,如果用户为“ IsVisible”选择“是”,那么我需要跳过验证技术资料“ CheckIsVisible”

1 个答案:

答案 0 :(得分:1)

声明类型为布尔值时,请区分大小写

    <ValidationTechnicalProfile ReferenceId="CheckIsVisible">
        <Preconditions>
        <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
            <Value>IsVisible</Value>
            <Value>true</Value>
            <Action>SkipThisValidationTechnicalProfile</Action>
        </Precondition>
    </Preconditions>

    <ValidationTechnicalProfile ReferenceId="CheckIsVisible">
        <Preconditions>
        <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
            <Value>IsVisible</Value>
            <Value>True</Value>
            <Action>SkipThisValidationTechnicalProfile</Action>
        </Precondition>
    </Preconditions>