问题描述
我在 WingTig Games演示代码之后,通过JWT将隐藏的声明发送到B2C .我如何要求依赖方发送索赔?如果未发送,是否阻止了注册过程?并向用户提供我自己的错误消息?这些字段将对用户隐藏.
I'm sending hidden claims to B2C via a JWT following the WingTig Games demo code. How do I require claim(s) to be sent by the relying party? And if they are not sent, prevent the sign-up process? And provide my own error message to the user? These fields will be hidden from the user.
我尝试在RelyingParty
节点的叶子策略中添加必填项,但这让我通过了.我尝试将必填项添加到我的TechnicalProfile
节点,但它让我通过了.
I tried adding required in my leaf policy in the RelyingParty
node but it let me through. I tried adding required to my TechnicalProfile
node but it let me through.
<InputClaims>
<InputClaim ClaimTypeReferenceId="extension_my_claim" Required="true"/>
</InputClaims>
推荐答案
作为一种解决方法,您可以在步骤1和步骤2中添加前提条件,然后在客户错误页面中添加其他步骤.
As a workaround, you can add pre-condition to steps 1&2 then add additional step with your customer error page.
在下面的XML代码段中,我添加了前提条件,仅在您的声明存在的情况下才执行步骤1& 2,否则请跳至下一步.9月3日,前提条件仅在声明不存在时运行,然后显示自定义页面.这只是一个示例,您可以添加自己的错误页面.
In the XML snippet below, I have added pre-conditions that run the steps 1&2 only if your claim exists, otherwise skip to the next step.On sept 3, the pre-condition is run only if the claims does not exist, then display custom page. It’s just an example, in your case you can add your own error page.
<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
Locate the <ContentDefinitions>
element, and add following 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错误页面
Change the LoadUri value to point to your HTML error page
这篇关于在Azure AD B2C中要求来自JWT的RelyingParty的输入声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!