You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure AD B2C自定义策略集成OIDC时配置ValidationTechnicalProfile报错问询

问题根因

Azure AD B2C自定义策略的框架限制中,ValidationTechnicalProfile 仅允许配置在协议处理程序为 Web.TPEngine.Providers.SelfAssertedAttributeProvider 的技术配置下,这类技术配置对应需要用户交互的自断言页面(如注册页、资料编辑页、条款同意页)。你当前使用的是OpenIdConnect协议类型的身份源对接技术配置,作用仅为和外部Azure AD身份源完成认证流程、拉取用户身份声明,本身不支持直接挂载验证技术配置,因此会触发报错。

解决方法

步骤1:清理现有OIDC技术配置

删除你现有AADContoso-OpenIdConnect技术配置中的整个<ValidationTechnicalProfiles>代码段,先保证Contoso Azure AD的基础登录流程可以正常运行,成功获取到用户的oid、姓名、邮箱等基础身份声明。

步骤2:调整用户旅程编排逻辑

在用户旅程(UserJourney)中,在Contoso OIDC登录的编排步骤之后,新增对应步骤处理用户数据写入、条款同意校验逻辑:

  • 若需要实现条款同意用户交互:新增一个自断言类型的技术配置,用于展示服务条款、收集用户同意状态,在该自断言技术配置下挂载你需要的AAD-UserWriteUsingLogonEmail作为验证技术配置,完成用户属性写入。
  • 若不需要用户交互、仅需静默写入用户数据:直接新增一个编排步骤,调用AAD-UserWriteUsingLogonEmail技术配置完成写入即可,无需经过自断言页面。

可选优化:老用户免重复同意

可以在条款同意步骤之前新增一个用户属性读取的编排步骤,先查询当前登录用户的extension_TOUConsentChoice属性:如果用户已经同意过条款,直接跳过条款同意步骤;如果是新用户未存储该属性,或者属性为未同意状态,再进入条款同意页面。

配置示例

自断言条款同意技术配置示例

<TechnicalProfile Id="SelfAsserted-TOUConsent">
  <DisplayName>服务条款同意</DisplayName>
  <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  <Metadata>
    <Item Key="ContentDefinitionReferenceId">api.selfasserted.tou</Item>
    <Item Key="UserMessageIfClaimsNotCollected">您需要同意服务条款才可继续使用</Item>
  </Metadata>
  <OutputClaims>
    <OutputClaim ClaimTypeReferenceId="extension_TOUConsentChoice" Required="true"/>
    <!-- 补充其他需要透传的用户声明,如邮箱、姓名等 -->
  </OutputClaims>
  <ValidationTechnicalProfiles>
    <ValidationTechnicalProfile ReferenceId="AAD-UserWriteUsingLogonEmail" />
  </ValidationTechnicalProfiles>
</TechnicalProfile>

对应编排步骤示例

<!-- 原有Contoso Azure AD登录步骤 -->
<OrchestrationStep Order="4" Type="ClaimsExchange">
  <ClaimsExchanges>
    <ClaimsExchange Id="ContosoAADLogin" TechnicalProfileReferenceId="AADContoso-OpenIdConnect"/>
  </ClaimsExchanges>
</OrchestrationStep>
<!-- 新增条款同意步骤 -->
<OrchestrationStep Order="5" Type="ClaimsExchange">
  <Preconditions>
    <!-- 已同意条款的用户跳过当前步骤 -->
    <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
      <Value>extension_TOUConsentChoice</Value>
      <Action>SkipThisOrchestrationStep</Action>
    </Precondition>
  </Preconditions>
  <ClaimsExchanges>
    <ClaimsExchange Id="TOUConsentExchange" TechnicalProfileReferenceId="SelfAsserted-TOUConsent"/>
  </ClaimsExchanges>
</OrchestrationStep>

内容的提问来源于stack exchange,提问作者user1037747

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.09 09:18:05