azure - Azure B2C 自定义策略 - 有没有办法在 ClaimsProviderSelection 编排步骤中显示声明
问题描述
我目前正在为我的身份验证流使用 Azure B2C 自定义策略。
我有一个 ClaimsProviderSelection 编排步骤,它向用户显示了两个选项:
- 将代码发送到他们在身份验证方法中保存的 MFA 电子邮件
- 丢失的电子邮件
我想做的是通过在显示文本或按钮本身中使用 ClaimProvider 来显示用户的电子邮件地址(见下文)
如果这是不可能的,那么我希望能够在验证控制页面本身上添加一个“丢失的电子邮件”按钮 - 如下所示:
不过,从我所看到的来看,这似乎仅适用于“ForgotPasswordExchange”(如此处所示:https ://docs.microsoft.com/en-us/azure/active-directory-b2c/add-password-reset- policy?pivots=b2c-custom-policy)用于密码而不是身份验证方法。
如果有人对自定义 ClaimsProviderSelection 步骤或在编排步骤上添加自定义链接有任何经验,我们将不胜感激!
请参阅下面的代码示例:
编排步骤:
<OrchestrationStep Order="2" Type="ClaimsProviderSelection" ContentDefinitionReferenceId='api.MFAselections' >
<Preconditions>
<Precondition Type="ClaimsExist" ExecuteActionsIf="false">
<Value>strongAuthenticationEmailAddress</Value>
<Value>strongAuthenticationPhoneNumber</Value>
<Action>SkipThisOrchestrationStep</Action>
</Precondition>
</Preconditions>
<ClaimsProviderSelections>
<ClaimsProviderSelection TargetClaimsExchangeId="MFAVerifyEmailAddress" />
<ClaimsProviderSelection TargetClaimsExchangeId="LostEmailExchange" />
</ClaimsProviderSelections>
</OrchestrationStep>
技术简介:
<TechnicalProfile Id="MFA_VerifyEmailAddress">
<DisplayName>SEND TO {Claim:strongAuthenticationEmailAddress}
</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="ContentDefinitionReferenceId">MFAVerifyEmail</Item>
<Item Key="IncludeClaimResolvingInClaimsHandling">true</Item>
<!-- <Item Key="setting.showContinueButton">false</Item> -->
<Item Key="setting.showCancelButton">false</Item>
<Item Key="UserMessageIfSessionDoesNotExist">You have exceeded the maximum time allowed.</Item>
<Item Key="UserMessageIfMaxRetryAttempted">You have exceeded the number of retries allowed.</Item>
<Item Key="UserMessageIfInvalidCode">You have entered the wrong code.</Item>
<Item Key="UserMessageIfSessionConflict">Cannot verify the code, please try again later.</Item>
</Metadata>
<InputClaims>
<InputClaim ClaimTypeReferenceId="MFAcomplete" DefaultValue="true" AlwaysUseDefaultValue='true'/>
</InputClaims>
<DisplayClaims>
<DisplayClaim DisplayControlReferenceId="emailVerificationControl" />
</DisplayClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="MFAcomplete" DefaultValue="email" AlwaysUseDefaultValue='true' />
<OutputClaim ClaimTypeReferenceId="isLostEmail" DefaultValue="false" AlwaysUseDefaultValue='true' />
</OutputClaims>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />
</TechnicalProfile>
解决方案
对于遇到此问题的任何人-这就是我最终要做的事情:
- 在 RelyingParty 中添加 ContentDefinitionParameters 并声明 UserJourneyBehaviors
<ContentDefinitionParameters> <Parameter Name="email">{Claim:maskedEmail}</Parameter> </ContentDefinitionParameters>
- 使用 JS 从源代码中抓取电子邮件声明,并插入到 HTML
const parser = new URL(SETTINGS.remoteResource); let email = parser.searchParams.get('email');
推荐阅读
- node.js - 为什么我得到一个损坏的图像图标?
- javascript - React GraphQL 和 ApolloServer:未处理的拒绝(错误):GraphQL 错误:在初始化之前无法访问“post”
- bash - 使用脚本自动化交互式会话
- mysql - 我正在尝试为一个项目制作座位预订系统。此代码无法显示哪些座位已被占用
- c# - WCF 在 IIS 中发布 - 无法获取 wsdl 定义
- r - 使用 r 以周为单位对数据进行分组
- image - 在flutter中,如何多次使用网络图像而无需再次调用?
- huggingface-transformers - 使用数据集、标记器和火炬数据集和数据加载器进行动态标记化
- algorithm - 使用分治法查找序列中的数字
- javascript - 在 typescript 中使用 try-catch 包围 super()