简体   繁体   English

Azure AD B2C 自定义策略验证代码并在同一操作中继续

[英]Azure AD B2C Custom Policy Verify Code & Continue in same Action

I have a existing user flow which is working as expected with verify code and continue button action.我有一个现有的用户流程,它按预期工作,带有验证码并继续按钮操作。 Currently the issue is user has to click so many action buttons to login if MFA is enabled.当前的问题是,如果启用了 MFA,用户必须单击太多操作按钮才能登录。 So the expected user flow should skip or bypass the step of continue where verify action button will handle both validation of otp as well as continue user flow in single click.因此,预期的用户流程应该跳过或绕过继续步骤,其中验证操作按钮将处理 otp 验证以及单击继续用户流程。 I am trying to combine step to verify code and continue button in one action.我正在尝试结合步骤来验证代码并在一个操作中继续按钮。 Any kind of help is appreciated and thanks in advance.感谢任何形式的帮助,并提前致谢。 Attaching image for better understanding too.附上图片也可以更好地理解。 Below is my code下面是我的代码

    <DisplayControls>
      <DisplayControl Id="emailVerificationControl" UserInterfaceControlType="VerificationControl">
        <DisplayClaims>
          <DisplayClaim ClaimTypeReferenceId="email" Required="true" />
          <DisplayClaim ClaimTypeReferenceId="verificationCode" ControlClaimType="VerificationCode" Required="true" />
        </DisplayClaims>
        <OutputClaims>
          <OutputClaim ClaimTypeReferenceId="email" />
        </OutputClaims>
        <Actions>
          <Action Id="SendCode">
            <ValidationClaimsExchange>
              <ValidationClaimsExchangeTechnicalProfile TechnicalProfileReferenceId="SelfAsserted-GenerateOtp" />
              <ValidationClaimsExchangeTechnicalProfile TechnicalProfileReferenceId="SendGridSendOtp" />
            </ValidationClaimsExchange>
          </Action>
          <Action Id="VerifyCode">
            <ValidationClaimsExchange>
              <ValidationClaimsExchangeTechnicalProfile TechnicalProfileReferenceId="SelfAsserted-VerifyOtp" />
            </ValidationClaimsExchange>
          </Action>
        </Actions>
      </DisplayControl>
<ClaimsProvider>
      <DisplayName>SelfAsserted-VerifyOtp</DisplayName>
      <TechnicalProfiles>
        <TechnicalProfile Id="SelfAsserted-VerifyOtp">
          <DisplayName>Verify one time password</DisplayName>
          <Protocol
            Name="Proprietary"
            Handler="Web.TPEngine.Providers.OneTimePasswordProtocolProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
          />
          <Metadata>
            <Item Key="Operation">VerifyCode</Item>
          </Metadata>
          <InputClaims>
            <InputClaim ClaimTypeReferenceId="email" PartnerClaimType="identifier" />
            <InputClaim ClaimTypeReferenceId="verificationCode" PartnerClaimType="otpToVerify" />
          </InputClaims>
        </TechnicalProfile>
      </TechnicalProfiles>
    </ClaimsProvider>

    <ClaimsProvider>
      <DisplayName>SelfAsserted-GenerateOtp</DisplayName>
      <TechnicalProfiles>
        <TechnicalProfile Id="SelfAsserted-GenerateOtp">
          <DisplayName>Generate one time password</DisplayName>
          <Protocol
            Name="Proprietary"
            Handler="Web.TPEngine.Providers.OneTimePasswordProtocolProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
          />
          <Metadata>
            <Item Key="Operation">GenerateCode</Item>
            <Item Key="CodeExpirationInSeconds">1200</Item>
            <Item Key="CodeLength">6</Item>
            <Item Key="CharacterSet">0-9</Item>
            <Item Key="ReuseSameCode">true</Item>
            <Item Key="NumRetryAttempts">5</Item>
          </Metadata>
          <InputClaims>
            <InputClaim ClaimTypeReferenceId="email" PartnerClaimType="identifier" />
          </InputClaims>
          <OutputClaims>
            <OutputClaim ClaimTypeReferenceId="otp" PartnerClaimType="otpGenerated" />
          </OutputClaims>
        </TechnicalProfile>
      </TechnicalProfiles>
    </ClaimsProvider>

Existing User Flow Expected User Flow现有用户流预期用户流

You cannot merge the Verify code and Continue buttons in one button using Custom Policy.您不能使用自定义策略将验证代码和继续按钮合并为一个按钮。 You need to work with a front-end developer to use a custom HTML page for your signup/sign-in with JavaScript/CSS for this purpose.为此,您需要与前端开发人员合作,使用自定义 HTML 页面通过 JavaScript/CSS 进行注册/登录。

You may consider using JavaScript MutationObserver to detect that the Continue button has been enabled, then automate the clicks with javascript您可以考虑使用 JavaScript MutationObserver 来检测“继续”按钮是否已启用,然后使用 javascript 自动执行点击

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM