docs: protected void registerMultifactorProviderAuthenticationWebflow(final Flow flow, final String subflowId,
                                                                      final FlowDefinitionRegistry mfaProviderFlowRegistry,
                                                                      final String providerId) {
          if (!mfaProviderFlowRegistry.containsFlowDefinition(subflowId)) {
              LOGGER.warn("Could not locate flow id [{}]", subflowId);
              return;
          }
          val mfaFlow = (Flow) mfaProviderFlowRegistry.getFlowDefinition(subflowId);
          mfaFlow.getStartActionList().add(createSetAction("flowScope.".concat(CasWebflowConstants.VAR_ID_MFA_PROVIDER_ID), StringUtils.quote(providerId)));
  
          val initStartState = (ActionState) mfaFlow.getStartState();
          val transition = (Transition) initStartState.getTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS);
          val targetStateId = transition.getTargetStateId();
          transition.setTargetStateResolver(new DefaultTargetStateResolver(CasWebflowConstants.STATE_ID_MFA_CHECK_BYPASS));
  
          val bypassAction = createActionState(mfaFlow, CasWebflowConstants.STATE_ID_MFA_CHECK_BYPASS, createEvaluateAction(MFA_CHECK_BYPASS_BEAN_ID));
          createTransitionForState(bypassAction, CasWebflowConstants.TRANSITION_ID_NO, CasWebflowConstants.STATE_ID_MFA_CHECK_AVAILABLE);
          createTransitionForState(bypassAction, CasWebflowConstants.TRANSITION_ID_YES, CasWebflowConstants.TRANSITION_ID_SUCCESS);
  
          val availableAction = createActionState(mfaFlow, CasWebflowConstants.STATE_ID_MFA_CHECK_AVAILABLE, createEvaluateAction(MFA_CHECK_AVAILABLE_BEAN_ID));
          if (mfaFlow.containsState(CasWebflowConstants.STATE_ID_MFA_PRE_AUTH)) {
              createTransitionForState(availableAction, CasWebflowConstants.TRANSITION_ID_YES, CasWebflowConstants.STATE_ID_MFA_PRE_AUTH);
          } else {
              createTransitionForState(availableAction, CasWebflowConstants.TRANSITION_ID_YES, targetStateId);
          }
          createTransitionForState(availableAction, CasWebflowConstants.TRANSITION_ID_NO, CasWebflowConstants.TRANSITION_ID_MFA_FAILURE);
  
          val failureAction = createActionState(mfaFlow, CasWebflowConstants.TRANSITION_ID_MFA_FAILURE, createEvaluateAction(MFA_CHECK_FAILURE_BEAN_ID));
          createTransitionForState(failureAction, CasWebflowConstants.TRANSITION_ID_UNAVAILABLE, CasWebflowConstants.TRANSITION_ID_UNAVAILABLE);
          createTransitionForState(failureAction, CasWebflowConstants.TRANSITION_ID_BYPASS, CasWebflowConstants.TRANSITION_ID_SUCCESS);
  
          LOGGER.trace("Adding end state [{}] with transition to [{}] to flow [{}] for MFA",
              CasWebflowConstants.STATE_ID_MFA_UNAVAILABLE, CasWebflowConstants.VIEW_ID_MFA_UNAVAILABLE, flow.getId());
          createEndState(flow, CasWebflowConstants.STATE_ID_MFA_UNAVAILABLE, CasWebflowConstants.VIEW_ID_MFA_UNAVAILABLE);
  
          LOGGER.trace("Adding end state [{}] with transition to [{}] to flow [{}] for MFA",
              CasWebflowConstants.STATE_ID_MFA_DENIED, CasWebflowConstants.VIEW_ID_MFA_DENIED, flow.getId());
          createEndState(flow, CasWebflowConstants.STATE_ID_MFA_DENIED, CasWebflowConstants.VIEW_ID_MFA_DENIED);
  
          val subflowState = createSubflowState(flow, subflowId, subflowId);
          val states = getCandidateStatesForMultifactorAuthentication();
          LOGGER.trace("Candidate states for multifactor authentication are [{}]", states);
  
          states.forEach(s -> {
              LOGGER.trace("Locating state [{}] to process for multifactor authentication", s);
              val actionState = getState(flow, s);
  
              LOGGER.trace("Adding transition [{}] to [{}] for [{}]", CasWebflowConstants.TRANSITION_ID_DENY, CasWebflowConstants.STATE_ID_MFA_DENIED, s);
              createTransitionForState(actionState, CasWebflowConstants.TRANSITION_ID_DENY, CasWebflowConstants.STATE_ID_MFA_DENIED);
  
              LOGGER.trace("Adding transition [{}] to [{}] for [{}]", CasWebflowConstants.TRANSITION_ID_UNAVAILABLE, CasWebflowConstants.STATE_ID_MFA_UNAVAILABLE, s);
              createTransitionForState(actionState, CasWebflowConstants.TRANSITION_ID_UNAVAILABLE, CasWebflowConstants.STATE_ID_MFA_UNAVAILABLE);
  
              LOGGER.trace("Locating transition id [{}] to process multifactor authentication for state [{}]", CasWebflowConstants.TRANSITION_ID_SUCCESS, s);
              val targetSuccessId = actionState.getTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS).getTargetStateId();
  
              LOGGER.trace("Locating transition id [{}] to process multifactor authentication for state [{}]", CasWebflowConstants.TRANSITION_ID_SUCCESS_WITH_WARNINGS, s);
              val targetWarningsId = actionState.getTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS_WITH_WARNINGS).getTargetStateId();
  
              LOGGER.trace("Locating transition id [{}] to process multifactor authentication for state [{}]", CasWebflowConstants.TRANSITION_ID_DENY, s);
              val targetDenied = actionState.getTransition(CasWebflowConstants.TRANSITION_ID_DENY).getTargetStateId();
  
              LOGGER.trace("Location transition id [{}] to process multifactor authentication for stat [{}]", CasWebflowConstants.TRANSITION_ID_UNAVAILABLE, s);
              val targetUnavailable = actionState.getTransition(CasWebflowConstants.TRANSITION_ID_UNAVAILABLE).getTargetStateId();
  
              val mappings = new ArrayList<DefaultMapping>();
              val inputMapper = createMapperToSubflowState(mappings);
              val subflowMapper = createSubflowAttributeMapper(inputMapper, null);
              subflowState.setAttributeMapper(subflowMapper);
  
              LOGGER.trace("Creating transitions to subflow state [{}]", subflowState.getId());
              val transitionSet = subflowState.getTransitionSet();
              transitionSet.add(createTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS, targetSuccessId));
              transitionSet.add(createTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS_WITH_WARNINGS, targetWarningsId));
              transitionSet.add(createTransition(CasWebflowConstants.TRANSITION_ID_DENY, targetDenied));
              transitionSet.add(createTransition(CasWebflowConstants.TRANSITION_ID_UNAVAILABLE, targetUnavailable));
              transitionSet.add(createTransition(CasWebflowConstants.TRANSITION_ID_CANCEL, CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
  
              LOGGER.trace("Creating transition [{}] for state [{}]", subflowId, actionState.getId());
              createTransitionForState(actionState, subflowId, subflowId);
          });
  
          registerMultifactorFlowDefinitionIntoLoginFlowRegistry(mfaProviderFlowRegistry);
          augmentMultifactorProviderFlowRegistry(mfaProviderFlowRegistry);
  
          LOGGER.trace("Registering the [{}] flow into the flow [{}]", subflowId, flow.getId());
          val startState = flow.getTransitionableState(flow.getStartState().getId());
          createTransitionForState(startState, subflowId, subflowId);
  
          val initState = flow.getTransitionableState(CasWebflowConstants.STATE_ID_INITIAL_AUTHN_REQUEST_VALIDATION_CHECK);
          createTransitionForState(initState, subflowId, subflowId);
      }