【问题标题】:Continue Azure B2C user journey on authentication failure在身份验证失败时继续 Azure B2C 用户旅程
【发布时间】:2020-06-11 14:28:54
【问题描述】:

我正在使用 Azure B2C 身份体验框架创建自定义用户旅程。我的问题是我想在身份验证失败时继续用户旅程。但是,身份验证失败似乎被解释为异常,从而导致旅程终止。

此旅程旨在适应从传统身份提供商到 B2C 的即时帐户迁移过程。

我想要完成的流程是:

  1. 尝试使用 B2C 登录表单进行身份验证
  2. 身份验证失败时,查询 REST API 以确定用户的电子邮件地址是否存在于旧系统中
  3. 如果电子邮件地址存在,则向用户提供 B2C 注册表单

这种情况可能吗?

【问题讨论】:

  • 嗨 Christok,您是否考虑过先在本地检查(不进行身份验证)以查看用户是否存在。如果用户确实存在,则质询登录非交互式。如果没有,那么查询 Rest?
  • 最终这可能是我必须采用的方式,但我宁愿不这样做。原因是开销:如果用户已经有一个 B2C 帐户,那么没有理由产生通过 API 调用来检索我已经知道的信息的资源成本。

标签: azure-ad-b2c identity-experience-framework


【解决方案1】:

我不确定是否有办法在完全身份验证失败时继续,但如果只检查用户帐户的存在就足够了,您可能不需要这样做。

您可以在不尝试验证的情况下检查输入的用户名是否存在于 B2C 中。如果用户在目录中不存在,将 RaiseErrorIfClaimsPrincipalDoesNotExist 元数据设置为 false 允许 B2C 策略继续。然后,您可以使用输入的用户名并继续其他技术配置文件。

我使用下面的 sn-p 作为验证技术配置文件,如果找到对象 ID,我运行 login-NonInteractive 配置文件,如果没有,我运行自定义身份验证配置文件

   <TechnicalProfile Id="AAD-UserReadUsingEmailAddress-NoError">
  <Metadata>
    <Item Key="Operation">Read</Item>
    <Item Key="RaiseErrorIfClaimsPrincipalDoesNotExist">false</Item>
  </Metadata>
  <IncludeInSso>false</IncludeInSso>
  <InputClaims>
    <InputClaim ClaimTypeReferenceId="signInName" PartnerClaimType="signInNames.emailAddress" />
  </InputClaims>
  <OutputClaims>
    <!-- Required claims -->
    <OutputClaim ClaimTypeReferenceId="objectId" />
    <OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="localAccountAuthentication" />
    <OutputClaim ClaimTypeReferenceId="extension_isMigrated" DefaultValue="False" />
    <OutputClaim ClaimTypeReferenceId="strongAuthenticationPhoneNumber" />
    <!-- Optional claims -->
    <OutputClaim ClaimTypeReferenceId="userPrincipalName" />
    <OutputClaim ClaimTypeReferenceId="displayName" />
    <OutputClaim ClaimTypeReferenceId="accountEnabled" />
    <OutputClaim ClaimTypeReferenceId="otherMails" />
    <OutputClaim ClaimTypeReferenceId="signInNames.emailAddress" />
    <OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="signInNames.emailAddress" />
  </OutputClaims>
  <IncludeTechnicalProfile ReferenceId="AAD-Common" />
</TechnicalProfile>

【讨论】:

  • 感谢您的想法,很抱歉回复晚了。我仍然没有完全让我满意,但是该解决方案似乎确实运行了一系列验证技术配置文件,而您的 sn-p 将是关键。我称之为公认的答案。谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-06-25
  • 2015-12-22
  • 1970-01-01
  • 2022-11-04
  • 2017-07-25
  • 1970-01-01
  • 2020-08-26
相关资源
最近更新 更多