Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure ad b2c AAD B2C注册人通过验证电子邮件和验证电话登录_Azure Ad B2c_Azure Ad B2c Custom Policy - Fatal编程技术网

Azure ad b2c AAD B2C注册人通过验证电子邮件和验证电话登录

Azure ad b2c AAD B2C注册人通过验证电子邮件和验证电话登录,azure-ad-b2c,azure-ad-b2c-custom-policy,Azure Ad B2c,Azure Ad B2c Custom Policy,通常,我们会通过电子邮件或电话进行注册/登录,但我需要注册/登录,同时要求验证电子邮件和验证电话号码 我尝试使用默认的“用户流”进行设置,并启用了电话/短信的MFA,但无法通过phoneMethods的graph API调用访问该号码,如果可以,我还可以将该号码复制到配置文件中(这意味着它是一个已验证的电话号码)。此外,启用身份验证方法,甚至在配置文件页面上更新(电话号码用空格字符分隔代码和号码)电话号码会导致电话号码通过phoneMethods graph API调用显示,但在此之前不会显示

通常,我们会通过电子邮件或电话进行注册/登录,但我需要注册/登录,同时要求验证电子邮件验证电话号码

我尝试使用默认的“用户流”进行设置,并启用了电话/短信的MFA,但无法通过phoneMethods的graph API调用访问该号码,如果可以,我还可以将该号码复制到配置文件中(这意味着它是一个已验证的电话号码)。此外,启用身份验证方法,甚至在配置文件页面上更新(电话号码用空格字符分隔代码和号码)电话号码会导致电话号码通过phoneMethods graph API调用显示,但在此之前不会显示

以前做过这项工作的人是否可以分享一些关于他们方法的见解,或者如果可能的话,是否可以分享自定义xml策略?我确实研究了github示例策略[https://github.com/azure-ad-b2c/samples/tree/master/policies],但我想两者都没有

[在上面编辑]

根据Wes的输入,我最终创建了一个如下所示的技术配置文件,并将其用于我的UserJourney->Orchestration步骤,发布PhoneFactor InputOrVerify步骤,如下所示(对格式表示歉意):


写
假的
真的
假的
当然,“扩展电话号码”是在ClaimsSchema中设置的,如下所示:

  <ClaimType Id="extension_PhoneNumber">
    <DisplayName>Phone Number</DisplayName>
    <DataType>string</DataType>
  </ClaimType>

电话号码
一串
希望这对某人有帮助。。。 干杯


PS:感谢对上述评论的任何更新,以使其正确/更好。

我做了一些类似的事情,但在我的情况下,我验证了一个新的MFA编号,因为我的流程重置了用户的MFA编号,但希望这能给你一个想法。作为一种方法,您可以从samples->addverifytheemail->addverifyphonenumber步骤中获取标准的登录流。我不知道您在自定义策略方面的经验,但我相信使用用于登录的示例自定义策略作为初始模板将是您最好的起点。然后在中添加两个业务流程步骤以进行验证。下面是我的实现中经过轻微修改的摘录

 <OrchestrationSteps>
    <OrchestrationStep ContentDefinitionReferenceId="api.signin" Order="1" Type="CombinedSignInAndSignUp">
      <ClaimsProviderSelections>
        <ClaimsProviderSelection ValidationClaimsExchangeId="LocalAccountSigninEmailExchange" />
      </ClaimsProviderSelections>
      <ClaimsExchanges>
        <ClaimsExchange Id="LocalAccountSigninEmailExchange" TechnicalProfileReferenceId="SelfAsserted-LocalAccountSignin-Email" />
      </ClaimsExchanges>
    </OrchestrationStep>
    <OrchestrationStep Order="2" Type="ClaimsExchange">
      <ClaimsExchanges>
        <ClaimsExchange Id="AADUserReadWithObjectId" TechnicalProfileReferenceId="AAD-UserReadUsingObjectId" />
      </ClaimsExchanges>
    </OrchestrationStep>
    
    <OrchestrationStep Order="3" Type="ClaimsExchange">
      <ClaimsExchanges>
        <ClaimsExchange Id="EmailVerifyOnSignIn" TechnicalProfileReferenceId="EmailVerifyOnSignIn" />
      </ClaimsExchanges>
    </OrchestrationStep>

    <OrchestrationStep Order="4" Type="ClaimsExchange">
      <ClaimsExchanges>
        <ClaimsExchange Id="NewPhoneFactor" TechnicalProfileReferenceId="PhoneFactor-Verify" />
      </ClaimsExchanges>
    </OrchestrationStep>

    <OrchestrationStep CpimIssuerTechnicalProfileReferenceId="JwtIssuer" Order="5" Type="SendClaims" />

步骤1、2和5应能够直接从样本中复制,只需将电子邮件作为只读声明输出,以用于验证(请参见以下步骤)

如果您选择此路径,您的本地帐户登录将需要添加一个转换,该转换将从登录名生成只读电子邮件。
因此,在您的本地帐户中,您将拥有

          <OutputClaimsTransformations>
        <OutputClaimsTransformation ReferenceId="CopySignInNameToReadOnly" />
      </OutputClaimsTransformations>

在输出声明和正在使用的转换之后,将如下所示:

 <ClaimsTransformation Id="CopySignInNameToReadOnly" TransformationMethod="FormatStringClaim">
    <InputClaims>
      <InputClaim ClaimTypeReferenceId="signInName" TransformationClaimType="inputClaim" />
    </InputClaims>
    <InputParameters>
      <InputParameter Id="stringFormat" DataType="string" Value="{0}" />
    </InputParameters>
    <OutputClaims>
      <OutputClaim ClaimTypeReferenceId="readOnlyEmail" TransformationClaimType="outputClaim" />
    </OutputClaims>
  </ClaimsTransformation>

请确保在claimstypes部分定义您的只读声明:

      <ClaimType Id="readOnlyEmail">
    <DisplayName>Email Address</DisplayName>
    <DataType>string</DataType>
    <UserHelpText />
    <UserInputType>Readonly</UserInputType>
  </ClaimType>

电子邮件地址
一串
只读
这只是一个简单的声明副本转换

进行每项验证的步骤3和步骤4的技术概要如下所示:

  <TechnicalProfile Id="EmailVerifyOnSignIn">
      <DisplayName>EmailVerifyOnSignIn</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.EmailPage</Item>
      </Metadata>
      <InputClaims>
        <InputClaim ClaimTypeReferenceId="readOnlyEmail" />
      </InputClaims>
      <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="readOnlyEmail" PartnerClaimType="Verified.Email" />
      </OutputClaims>
    </TechnicalProfile>

EmailVerifyOnSignIn
api.selfasserted.EmailPage
这将验证用于登录的电子邮件,然后以下编排步骤将用于验证MFA

您必须对下一个技术配置文件进行更改,但基本思路与电子邮件相同,这里是一个起点:

        <TechnicalProfile Id="PhoneFactor-Verify">
      <DisplayName>PhoneFactor</DisplayName>
      <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.PhoneFactorProtocolProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
      <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="Verified.strongAuthenticationPhoneNumber" />
      </OutputClaims>
      <UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />
    </TechnicalProfile>

音素
最终结果将是:

  • 用户使用电子邮件和密码登录
  • 用户单击按钮以验证登录期间使用的电子邮件
  • 用户验证电话号码
  • 发送索赔并完成旅程

  • 谢谢你花时间回答我的问题,它确实帮了我一点方向。很抱歉,我不能对你的答案进行投票,没有足够的声望点数!:P我最终确实配置了PhoneFactor InputOrVerify,但缺少对声明的持久化。因此,我们必须在一份新的技术文件中提出如下内容:
    希望这能帮助被它阻止的人。
            <TechnicalProfile Id="PhoneFactor-Verify">
          <DisplayName>PhoneFactor</DisplayName>
          <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.PhoneFactorProtocolProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
          <OutputClaims>
            <OutputClaim ClaimTypeReferenceId="Verified.strongAuthenticationPhoneNumber" />
          </OutputClaims>
          <UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />
        </TechnicalProfile>