1

有人可以帮助我理解 Azure AD B2C 的这种行为,并揭示我在 SSO 会话中不理解的内容。

我有一个相当复杂的登录自定义策略,其中包括自定义注册和嵌入式重置密码的子旅程,遵循嵌入式密码重置示例。我有一个声明signinOption,它被设置为SignUpForgotPassword取决于CombinedSignInAndSignUp编排步骤中的声明提供者选择。然后我检查 的值signinOption以决定是否启动每个子旅程。这一切都是第一次完美地工作。

我的问题是在使用 MSAL 和 React 时出现的,但我还没有确定如何可靠地重现它。似乎 MSAL 正在发送 cookie,而 B2C 正在检测现有会话,因此它跳过了登录屏幕,让我进入了其中一个子旅程(SignUp 或 ForgotPassword)。关闭浏览器并不能解决它。每次我启动我的网络应用程序时,它都会启动登录自定义策略,然后我就进入了错误的屏幕。我修复状态的唯一方法是清除我的 B2C 租户域的 cookie。

我有一个用户旅程日志,希望有人可以帮助我分析以找出问题所在。在这种情况下,流程直接进入忘记密码之旅。我可以看到它执行了ForgotPasswordExchange我的signinOption声明,这就是触发子旅程的原因。我的问题是为什么ForgotPasswordExchange当用户没有在登录屏幕上单击忘记密码时它会执行,因为登录屏幕被完全跳过了。

它是否以某种方式从会话中记住了它?

一些代码可以让我了解我的设置,这是关键部分。

覆盖忘记的密码和注册链接:

<TechnicalProfile Id="ForgotPassword">
    <DisplayName>Forgot your password?</DisplayName>
    <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.ClaimsTransformationProtocolProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
    <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="signinOption" DefaultValue="ForgotPassword" AlwaysUseDefaultValue="true"/>
    </OutputClaims>
</TechnicalProfile>
<TechnicalProfile Id="SignUp">
    <DisplayName>Sign up?</DisplayName>
    <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.ClaimsTransformationProtocolProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
    <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="signinOption" DefaultValue="SignUp" AlwaysUseDefaultValue="true"/>
    </OutputClaims>
</TechnicalProfile>
<TechnicalProfile Id="SelfAsserted-LocalAccountSignin-Email">
    <Metadata>
        <Item Key="setting.forgotPasswordLinkOverride">ForgotPasswordExchange</Item>
        <Item Key="SignUpTarget">SignUpExchange</Item>
    </Metadata>
</TechnicalProfile>

我的编排步骤:

<OrchestrationStep Order="1" Type="GetClaims"
                                   CpimIssuerTechnicalProfileReferenceId="IdTokenHint_ExtractClaims"/>
<OrchestrationStep Order="2" Type="CombinedSignInAndSignUp"
                   ContentDefinitionReferenceId="api.signuporsignin">
    <Preconditions>
        <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
            <Value>objectId</Value>
            <Action>SkipThisOrchestrationStep</Action>
        </Precondition>
        <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
            <Value>signinOption</Value>
            <Action>SkipThisOrchestrationStep</Action>
        </Precondition>
    </Preconditions>
    <ClaimsProviderSelections DisplayOption="ShowSingleProvider">
        <ClaimsProviderSelection ValidationClaimsExchangeId="LocalAccountSigninEmailExchange"/>
        <ClaimsProviderSelection TargetClaimsExchangeId="SignUpExchange"/>
        <ClaimsProviderSelection TargetClaimsExchangeId="ForgotPasswordExchange"/>
    </ClaimsProviderSelections>
    <ClaimsExchanges>
        <ClaimsExchange Id="LocalAccountSigninEmailExchange"
                        TechnicalProfileReferenceId="SelfAsserted-LocalAccountSignin-Email"/>
    </ClaimsExchanges>
</OrchestrationStep>
<OrchestrationStep Order="3" Type="ClaimsExchange">
    <Preconditions>
        <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
            <Value>objectId</Value>
            <Action>SkipThisOrchestrationStep</Action>
        </Precondition>
        <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
            <Value>signinOption</Value>
            <Action>SkipThisOrchestrationStep</Action>
        </Precondition>
    </Preconditions>
    <ClaimsExchanges>
        <ClaimsExchange Id="SignUpExchange" TechnicalProfileReferenceId="SignUp"/>
        <ClaimsExchange Id="ForgotPasswordExchange" TechnicalProfileReferenceId="ForgotPassword"/>
    </ClaimsExchanges>
</OrchestrationStep>
<OrchestrationStep Order="4" Type="InvokeSubJourney">
    <Preconditions>
        <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
            <Value>objectId</Value>
            <Action>SkipThisOrchestrationStep</Action>
        </Precondition>
        <Precondition Type="ClaimEquals" ExecuteActionsIf="false">
            <Value>signinOption</Value>
            <Value>ForgotPassword</Value>
            <Action>SkipThisOrchestrationStep</Action>
        </Precondition>
    </Preconditions>
    <JourneyList>
        <Candidate SubJourneyReferenceId="PasswordReset"/>
    </JourneyList>
</OrchestrationStep>
<OrchestrationStep Order="5" Type="InvokeSubJourney">
    <Preconditions>
        <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
            <Value>objectId</Value>
            <Action>SkipThisOrchestrationStep</Action>
        </Precondition>
        <Precondition Type="ClaimEquals" ExecuteActionsIf="false">
            <Value>signinOption</Value>
            <Value>SignUp</Value>
            <Action>SkipThisOrchestrationStep</Action>
        </Precondition>
    </Preconditions>
    <JourneyList>
        <Candidate SubJourneyReferenceId="SignUp"/>
    </JourneyList>
</OrchestrationStep>

和用户旅程日志:

[
  {
    "Kind": "Headers",
    "Content": {
      "UserJourneyRecorderEndpoint": "urn:journeyrecorder:applicationinsights",
      "CorrelationId": "7fcfa796-ecfe-43df-9e08-ec5317e1beb2",
      "EventInstance": "Event:AUTH",
      "TenantId": "mytenant.onmicrosoft.com",
      "PolicyId": "B2C_1A_Signin"
    }
  },
  {
    "Kind": "Transition",
    "Content": {
      "EventName": "AUTH",
      "StateName": "Initial"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.NoOpHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "Statebag": {
        "MACHSTATE": {
          "c": "2021-06-10T01:13:52.7375163Z",
          "k": "MACHSTATE",
          "v": "Initial",
          "p": true
        },
        "JC": {
          "c": "2021-06-10T01:13:52.7375163Z",
          "k": "JC",
          "v": "en",
          "p": true
        },
        "ComplexItems": "_MachineEventQ, TCTX"
      },
      "PredicateResult": "True"
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.OrchestrationManager"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "Statebag": {
        "Complex-CLMS": {},
        "ORCH_CS": {
          "c": "2021-06-10T01:13:52.7375163Z",
          "k": "ORCH_CS",
          "v": "0",
          "p": true
        },
        "RA": {
          "c": "2021-06-10T01:13:52.7375163Z",
          "k": "RA",
          "v": "0",
          "p": true
        },
        "ComplexItems": "_MachineEventQ, TCTX, ORCH_IDX"
      }
    }
  },
  {
    "Kind": "Transition",
    "Content": {
      "EventName": "PreStep",
      "StateName": "Initial"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.NoOpHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "PredicateResult": "True"
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.StateMachineHandlers.PreSetupHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "Statebag": {
        "RPP": {
          "c": "2021-06-10T01:13:52.7375163Z",
          "k": "RPP",
          "v": "OAUTH2",
          "p": true
        },
        "RPIPP": {
          "c": "2021-06-10T01:13:52.7375163Z",
          "k": "RPIPP",
          "v": "OAuth2ProtocolProvider",
          "p": true
        },
        "OTID": {
          "c": "2021-06-10T01:13:52.7375163Z",
          "k": "OTID",
          "v": "mytenant.onmicrosoft.com",
          "p": true
        },
        "APPMV": {
          "c": "2021-06-10T01:13:52.7375163Z",
          "k": "APPMV",
          "v": "V2",
          "p": true
        }
      }
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.InitiatingMessageValidationHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": false,
      "RecorderRecord": {
        "Values": [
          {
            "Key": "Validation",
            "Value": {
              "Values": [
                {
                  "Key": "SubmittedBy",
                  "Value": "Application"
                },
                {
                  "Key": "ProtocolProviderType",
                  "Value": "OpenIdConnectProtocolProvider"
                }
              ]
            }
          }
        ]
      },
      "Statebag": {
        "CT": {
          "c": "2021-06-10T01:13:52.8875243Z",
          "k": "CT",
          "v": "Spa",
          "p": true
        },
        "CC": {
          "c": "2021-06-10T01:13:52.8875243Z",
          "k": "CC",
          "v": "gIsVYH_0vVOTcxFUoYdb9oen4eq6Bfionj1djotzkQ4",
          "p": true
        },
        "CCM": {
          "c": "2021-06-10T01:13:52.8875243Z",
          "k": "CCM",
          "v": "S256",
          "p": true
        },
        "MSG(508dad2b-059e-4fb5-9719-f24c8d5360e8)": {
          "c": "2021-06-10T01:13:52.8925242Z",
          "k": "MSG(508dad2b-059e-4fb5-9719-f24c8d5360e8)",
          "v": "{\"TenantId\":\"mytenant.onmicrosoft.com\",\"PolicyId\":\"B2C_1A_Signin\",\"RedirectUri\":\"https://mywebsite.com.au/\",\"AdditionalParameters\":{\"client-request-id\":\"eb98add7-a02c-3312-a98c-b0f9c6ddeb15\",\"x-client-SKU\":\"msal.js.browser\",\"x-client-VER\":\"2.14.2\",\"x-client-OS\":\"\",\"x-client-CPU\":\"\",\"client_info\":\"1\",\"code_challenge\":\"gIsVYH_0wWOTcxFUoYdb9oen4eq6Bfionj1djotzkQ4\",\"code_challenge_method\":\"S256\"},\"Nonce\":\"41d42929-eabb-45a3-b0f2-743b89247a24\",\"State\":\"eyJpZCI6IjEwOGUyOWUzLTY3YzMtNGQ1OS05YmFkLTBkMWIwN2QyM2ZiOSIsIm1ldGEiOnsiaW50ZXJhY3Rpb25UeXBlIjoicmVkaXJlY3QifX0=\",\"ClientId\":\"cb8678e1-0eee-4f6f-868a-72b968b0a8c0\",\"ResponseType\":\"code\",\"ResponseMode\":\"fragment\",\"ResponseRedirector\":{\"URI\":\"https://mywebsite.com.au\",\"D\":false,\"WF\":true},\"Scope\":\"https://mytenant.onmicrosoft.com/api/user.read openid profile offline_access\",\"AppModelVersion\":1,\"ScopedProviders\":[]}",
          "p": true,
          "t": "OAuth2"
        },
        "CMESSAGE": {
          "c": "2021-06-10T01:13:52.8925242Z",
          "k": "CMESSAGE",
          "v": "508dad2b-059e-4fb5-9719-f24c8d5360e8",
          "p": true
        },
        "IMESSAGE": {
          "c": "2021-06-10T01:13:52.8925242Z",
          "k": "IMESSAGE",
          "v": "508dad2b-059e-4fb5-9719-f24c8d5360e8",
          "p": true
        },
        "ComplexItems": "_MachineEventQ, TCTX, ORCH_IDX, REPRM, IC"
      },
      "PredicateResult": "True"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.NoOpHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "PredicateResult": "True"
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.SSO.ResetSSOSessionHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.StateMachineHandlers.ClientInputClaimsTransformationHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.OrchestrationManager"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "Statebag": {
        "ORCH_CS": {
          "c": "2021-06-10T01:13:52.9025365Z",
          "k": "ORCH_CS",
          "v": "1",
          "p": true
        }
      }
    }
  },
  {
    "Kind": "Transition",
    "Content": {
      "EventName": "GetClaims",
      "StateName": "AwaitingNextStep"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.NoOpHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "Statebag": {
        "MACHSTATE": {
          "c": "2021-06-10T01:13:52.9025365Z",
          "k": "MACHSTATE",
          "v": "AwaitingNextStep",
          "p": true
        }
      },
      "PredicateResult": "True"
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.StateMachineHandlers.GetRelyingPartyInputClaimsHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.OrchestrationManager"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "Statebag": {
        "ORCH_CS": {
          "c": "2021-06-10T01:13:52.9025365Z",
          "k": "ORCH_CS",
          "v": "2",
          "p": true
        }
      }
    }
  },
  {
    "Kind": "Transition",
    "Content": {
      "EventName": "CombinedSignInAndSignUp",
      "StateName": "AwaitingNextStep"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.SSO.IsSSOSessionParticipantHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "PredicateResult": "False"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.HomeRealmDiscoveryHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "RecorderRecord": {
        "Values": [
          {
            "Key": "HomeRealmDiscovery",
            "Value": {
              "Values": [
                {
                  "Key": "CurrentStep",
                  "Value": 2
                },
                {
                  "Key": "TechnicalProfileEnabled",
                  "Value": {
                    "EnabledRule": "Always",
                    "EnabledResult": true,
                    "TechnicalProfile": "SelfAsserted-LocalAccountSignin-Email"
                  }
                },
                {
                  "Key": "TechnicalProfileEnabled",
                  "Value": {
                    "EnabledRule": "Always",
                    "EnabledResult": true,
                    "TechnicalProfile": "SignUp"
                  }
                },
                {
                  "Key": "TechnicalProfileEnabled",
                  "Value": {
                    "EnabledRule": "Always",
                    "EnabledResult": true,
                    "TechnicalProfile": "ForgotPassword"
                  }
                }
              ]
            }
          }
        ]
      },
      "Statebag": {
        "TAGE": {
          "c": "2021-06-10T01:13:52.907517Z",
          "k": "TAGE",
          "v": "ForgotPasswordExchange",
          "p": true
        }
      },
      "PredicateResult": "True"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.NoOpHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "PredicateResult": "True"
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.SSO.SSOSessionHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.OrchestrationManager"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "Statebag": {
        "ORCH_CS": {
          "c": "2021-06-10T01:13:52.907517Z",
          "k": "ORCH_CS",
          "v": "3",
          "p": true
        }
      }
    }
  },
  {
    "Kind": "Transition",
    "Content": {
      "EventName": "ClaimsExchange",
      "StateName": "AwaitingNextStep"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.ShouldOrchestrationStepBeInvokedHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "RecorderRecord": {
        "Values": [
          {
            "Key": "EnabledForUserJourneysTrue",
            "Value": {
              "Values": [
                {
                  "Key": "CurrentStep",
                  "Value": 3
                },
                {
                  "Key": "TechnicalProfileEnabled",
                  "Value": {
                    "EnabledRule": "Always",
                    "EnabledResult": true,
                    "TechnicalProfile": "SignUp"
                  }
                },
                {
                  "Key": "TechnicalProfileEnabled",
                  "Value": {
                    "EnabledRule": "Always",
                    "EnabledResult": true,
                    "TechnicalProfile": "ForgotPassword"
                  }
                }
              ]
            }
          }
        ]
      },
      "PredicateResult": "True"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.IsClaimsExchangeProtocolARedirectionHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "PredicateResult": "False"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.IsClaimsExchangeProtocolAnApiHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "PredicateResult": "False"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.SSO.IsSSOSessionParticipantHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "PredicateResult": "False"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.IsClaimsExchangeProtocolAServiceCallHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "RecorderRecord": {
        "Values": [
          {
            "Key": "InitiatingClaimsExchange",
            "Value": {
              "ProtocolType": "backend protocol",
              "TargetEntity": "ForgotPasswordExchange",
              "TechnicalProfileId": "ForgotPassword",
              "ProtocolProviderType": "ClaimsTransformationProtocolProvider"
            }
          }
        ]
      },
      "PredicateResult": "True"
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.StateMachineHandlers.GenerateRequestInputParamsHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": false
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.StateMachineHandlers.InputClaimsTransformationHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.StateMachineHandlers.PersistedClaimsTransformationHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.StateMachineHandlers.OutputClaimsTransformationHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "RecorderRecord": {
        "Values": [
          {
            "Key": "GettingClaims",
            "Value": {
              "Values": [
                {
                  "Key": "InitiatingBackendClaimsExchange",
                  "Value": {
                    "TechnicalProfileId": "ForgotPassword",
                    "ProtocolProviderType": "ClaimsTransformationProtocolProvider"
                  }
                }
              ]
            }
          },
          {
            "Key": "OutputClaimsTransformation",
            "Value": {
              "Values": [
                {
                  "Key": "MappingDefaultValueForClaim",
                  "Value": {
                    "PartnerClaimType": "signinOption",
                    "PolicyClaimType": "signinOption"
                  }
                }
              ]
            }
          }
        ]
      },
      "Statebag": {
        "Complex-CLMS": {
          "signinOption": "ForgotPassword"
        }
      }
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.SSO.SSOSessionHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.OrchestrationManager"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "Statebag": {
        "ORCH_CS": {
          "c": "2021-06-10T01:13:52.9125258Z",
          "k": "ORCH_CS",
          "v": "4",
          "p": true
        }
      }
    }
  },
  {
    "Kind": "Transition",
    "Content": {
      "EventName": "InvokeSubJourney",
      "StateName": "AwaitingNextStep"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.NoOpHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "PredicateResult": "True"
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.StateMachineHandlers.EnqueueNewJourneyHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "RecorderRecord": {
        "Values": [
          {
            "Key": "SubJourneyInvoked",
            "Value": "PasswordReset"
          }
        ]
      },
      "Statebag": {
        "ORCH_CS": {
          "c": "2021-06-10T01:13:52.9125258Z",
          "k": "ORCH_CS",
          "v": "0",
          "p": true
        },
        "ComplexItems": "_MachineEventQ, TCTX, ORCH_IDX, REPRM, IC, JL"
      }
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.OrchestrationManager"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "Statebag": {
        "ORCH_CS": {
          "c": "2021-06-10T01:13:52.9125258Z",
          "k": "ORCH_CS",
          "v": "1",
          "p": true
        }
      }
    }
  },
  {
    "Kind": "Transition",
    "Content": {
      "EventName": "ClaimsExchange",
      "StateName": "AwaitingNextStep"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.ShouldOrchestrationStepBeInvokedHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "RecorderRecord": {
        "Values": [
          {
            "Key": "EnabledForUserJourneysTrue",
            "Value": {
              "Values": [
                {
                  "Key": "CurrentStep",
                  "Value": 1
                },
                {
                  "Key": "TechnicalProfileEnabled",
                  "Value": {
                    "EnabledRule": "Always",
                    "EnabledResult": true,
                    "TechnicalProfile": "LocalAccountDiscoveryUsingEmailAddress"
                  }
                }
              ]
            }
          }
        ]
      },
      "PredicateResult": "True"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.IsClaimsExchangeProtocolARedirectionHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "PredicateResult": "False"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.IsClaimsExchangeProtocolAnApiHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "RecorderRecord": {
        "Values": [
          {
            "Key": "InitiatingClaimsExchange",
            "Value": {
              "ProtocolType": "Identity Experience Engine API",
              "TargetEntity": "ForgotPasswordExchange",
              "TechnicalProfileId": "LocalAccountDiscoveryUsingEmailAddress",
              "ProtocolProviderType": "SelfAssertedAttributeProvider"
            }
          }
        ]
      },
      "PredicateResult": "True"
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.StateMachineHandlers.SwitchToApiOrchestrationHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true
    }
  },
  {
    "Kind": "Transition",
    "Content": {
      "EventName": "SELFASSERTED",
      "StateName": "AwaitingNextStep"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.SSO.IsSSOSessionParticipantHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "PredicateResult": "False"
    }
  },
  {
    "Kind": "Predicate",
    "Content": "Web.TPEngine.StateMachineHandlers.IsSelfAssertedEmpty"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "PredicateResult": "False"
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.StateMachineHandlers.InputClaimsTransformationHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.StateMachineHandlers.ConvertToAttributeFieldHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "Statebag": {
        "ComplexItems": "_MachineEventQ, TCTX, ORCH_IDX, REPRM, IC, JL, SA_FIELDS"
      }
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.StateMachineHandlers.ApiLoadHandler"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "Statebag": {
        "ComplexItems": "_MachineEventQ, TCTX, ORCH_IDX, REPRM, IC, JL, SA_FIELDS, EID, UXRC, ARC"
      }
    }
  },
  {
    "Kind": "Action",
    "Content": "Web.TPEngine.Api.ApiUIManager"
  },
  {
    "Kind": "HandlerResult",
    "Content": {
      "Result": true,
      "RecorderRecord": {
        "Values": [
          {
            "Key": "ApiUiManagerInfo",
            "Value": {
              "Values": [
                {
                  "Key": "Language",
                  "Value": "..."
                },
                {
                  "Key": "Settings",
                  "Value": "..."
                }
              ]
            }
          }
        ]
      }
    }
  }
]

4

1 回答 1

4

因此,通过反复试验,我找到了解决问题的方法,并认为我对 B2C 自定义策略的黑匣子有了一些额外的了解。

我想出了复制步骤:

  1. 在我的登录流程中选择注册或忘记密码。
  2. 完成注册/重置以重新登录我的应用程序。
  3. 关闭浏览器选项卡。
  4. 再次启动 Web 应用程序,MSAL 重定向到 B2C。
  5. 我登陆了我之前选择的流程,无法返回登录屏幕。

我的问题的解决方案是在<UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD"/>整个编排步骤中添加到每个技术配置文件中。这包括我为处理 SignUpLink 和 Forgot Password 目标而创建的声明交换 TP。

我的理解是,B2C 会逐步完成所有编排步骤,因为它检测到会话会跳过任何使用会话管理的 TP。在我的情况下,只有第 2 步SelfAsserted-LocalAccountSignin-Email有会话管理,所以这被跳过了。我只能假设之前选择的 Claims Provider 选择已保存并从会话中检索,这导致它的行为就像用户再次选择它一样。

由于后续步骤没有使用会话管理,它们最终被执行,使用户登陆注册或重置密码屏幕,具体取决于先前选择的索赔提供者。

如果有人可以扩展我的理解或提出更完善的解决方案,我会全力以赴。

于 2021-06-28T12:01:11.957 回答