需要来自Azure AD B2C中来自RelyingParty的JWT的输入声明

时间:2017-09-22 15:46:13

标签: azure-ad-b2c

sending hidden claims to B2C通过WingTig Games demo code之后的JWT。我如何要求依赖方发送索赔?如果没有发送,请阻止注册过程?并向用户提供我自己的错误消息。这些字段将对用户隐藏。

我尝试在RelyingParty节点中添加我的叶子策略中的必需项,但它让我完成了。我尝试将必需添加到我的TechnicalProfile节点,但它让我通过。

<InputClaims>
    <InputClaim ClaimTypeReferenceId="extension_my_claim" Required="true"/>
</InputClaims>

1 个答案:

答案 0 :(得分:0)

作为解决方法,您可以在步骤1和2中添加前置条件,然后在客户错误页面中添加其他步骤。

在下面的XML代码段中,我添加了仅在您的声明存在时运行步骤1和2的前提条件,否则请跳到下一步。 在9月3日,仅当声明不存在时才运行前置条件,然后显示自定义页面。这只是一个示例,在您的情况下,您可以添加自己的错误页面。

<OrchestrationStep Order="1" Type="CombinedSignInAndSignUp" ContentDefinitionReferenceId="api.signuporsignin">
  <Preconditions>
    <Precondition Type="ClaimsExist" ExecuteActionsIf="false">
      <Value>{your claim name}</Value>
      <Action>SkipThisOrchestrationStep</Action>
    </Precondition>
  </Preconditions>
  <ClaimsProviderSelections>
    <ClaimsProviderSelection TargetClaimsExchangeId="FacebookExchange" />
    <ClaimsProviderSelection ValidationClaimsExchangeId="LocalAccountSigninEmailExchange" />
  </ClaimsProviderSelections>
  <ClaimsExchanges>
    <ClaimsExchange Id="LocalAccountSigninEmailExchange" TechnicalProfileReferenceId="SelfAsserted-LocalAccountSignin-Email" />
  </ClaimsExchanges>
</OrchestrationStep>
<!-- Check if the user has selected to sign in using one of the social providers -->
<OrchestrationStep Order="2" Type="ClaimsExchange">
  <Preconditions>
    <Precondition Type="ClaimsExist" ExecuteActionsIf="false">
      <Value>{your claim name}</Value>
      <Action>SkipThisOrchestrationStep</Action>
    </Precondition>
  </Preconditions>

  <Precondition Type="ClaimsExist" ExecuteActionsIf="false">
    <Value>registrationSource</Value>
    <Action>SkipThisOrchestrationStep</Action>
  </Precondition>

  </Preconditions>
  <ClaimsExchanges>
    <ClaimsExchange Id="FacebookExchange" TechnicalProfileReferenceId="Facebook-OAUTH" />
    <ClaimsExchange Id="SignUpWithLogonEmailExchange" TechnicalProfileReferenceId="LocalAccountSignUpWithLogonEmail" />
  </ClaimsExchanges>
</OrchestrationStep>

<!-- Error message-->
<OrchestrationStep Order="3" Type="ReviewScreen" ContentDefinitionReferenceId="api.selfasserted">
  <Preconditions>
    <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
      <Value>registrationSource</Value>
      <Action>SkipThisOrchestrationStep</Action>
    </Precondition>
  </Preconditions>
</OrchestrationStep>


<!-- Rest of the UserJourney -->
</OrchestrationSteps>
</UserJourney> 

找到<ContentDefinitions>元素,然后添加以下XML

<ContentDefinition Id=" api.inputtoken.error ">
   <LoadUri>~/tenant/default/selfAsserted.cshtml</LoadUri>
   <RecoveryUri>~/common/default_page_error.html</RecoveryUri>
   <DataUri>urn:com:microsoft:aad:b2c:elements:selfasserted:1.1.0</DataUri>
   <Metadata>
       <Item Key="DisplayName">Collect information from user page</Item>
   </Metadata>
</ContentDefinition>

将LoadUri值更改为指向HTML错误页面