private void createClientRedirectSubflow(final Flow flow) {
        val redirectFlow = buildFlow(CasWebflowConfigurer.FLOW_ID_DELEGATION_REDIRECT);
        createEndState(redirectFlow, CasWebflowConstants.STATE_ID_SUCCESS);

        val storeWebflowAction = createActionState(redirectFlow, CasWebflowConstants.STATE_ID_DELEGATED_AUTHENTICATION_STORE,
            CasWebflowConstants.ACTION_ID_DELEGATED_AUTHENTICATION_STORE_WEBFLOW_STATE);
        createTransitionForState(storeWebflowAction, CasWebflowConstants.TRANSITION_ID_REDIRECT,
            CasWebflowConstants.STATE_ID_DELEGATED_AUTHENTICATION_CLIENT_REDIRECT);

        val redirectAction = createActionState(redirectFlow, CasWebflowConstants.STATE_ID_DELEGATED_AUTHENTICATION_CLIENT_REDIRECT,
            CasWebflowConstants.ACTION_ID_DELEGATED_AUTHENTICATION_CLIENT_REDIRECT);
        createTransitionForState(redirectAction, CasWebflowConstants.TRANSITION_ID_SUCCESS, CasWebflowConstants.STATE_ID_SUCCESS);

        redirectFlow.setStartState(storeWebflowAction);
        delegatedClientRedirectFlowRegistry.registerFlowDefinition(redirectFlow);
        flowDefinitionRegistry.registerFlowDefinition(redirectFlow);

        val casLoginViewState = getState(flow, CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM);
        createTransitionForState(casLoginViewState, CasWebflowConstants.TRANSITION_ID_DELEGATED_AUTHENTICATION_REDIRECT,
            CasWebflowConstants.STATE_ID_DELEGATED_AUTHENTICATION_CLIENT_SUBFLOW);

        val subflowState = createSubflowState(flow, CasWebflowConstants.STATE_ID_DELEGATED_AUTHENTICATION_CLIENT_SUBFLOW,
            CasWebflowConfigurer.FLOW_ID_DELEGATION_REDIRECT);
        createTransitionForState(subflowState, CasWebflowConstants.TRANSITION_ID_SUCCESS, CasWebflowConstants.STATE_ID_END_WEBFLOW);

        val customizers = applicationContext.getBeansOfType(DelegatedClientWebflowCustomizer.class)
            .values()
            .stream()
            .filter(BeanSupplier::isNotProxy)
            .sorted(AnnotationAwareOrderComparator.INSTANCE)
            .toList();

        val attrMapping = createFlowMapping("flowScope." + CasWebflowConstants.ATTRIBUTE_SERVICE, CasWebflowConstants.ATTRIBUTE_SERVICE);
        val attrMappings = CollectionUtils.wrapList(attrMapping);
        customizers.forEach(c -> c.getWebflowAttributeMappings()
            .forEach(key -> attrMappings.add(createFlowMapping("flowScope." + key, key))));
        val attributeMapper = createFlowInputMapper(attrMappings);
        val subflowMapper = createSubflowAttributeMapper(attributeMapper, null);
        subflowState.setAttributeMapper(subflowMapper);

        val mapping = createFlowMapping(CasWebflowConstants.ATTRIBUTE_SERVICE,
            "flowScope." + CasWebflowConstants.ATTRIBUTE_SERVICE, false, Service.class);
        val flowMappings = CollectionUtils.wrapList(mapping);
        customizers.forEach(c -> c.getWebflowAttributeMappings()
            .forEach(key -> flowMappings.add(createFlowMapping(key, "flowScope." + key))));
        createFlowInputMapper(flowMappings, redirectFlow);
    }
The {@link DelegatedAuthenticationWebflowConfigurer} is responsible for
adjusting the CAS webflow context for pac4j integration.

@author Misagh Moayyed
@since 4.2
support/cas-server-support-pac4j-core/src/main/java/org/apereo/cas/web/flow/DelegatedAuthenticationWebflowConfigurer.java