@Override
    protected Event doExecuteInternal(final RequestContext requestContext) {
        val userid = requestContext.getRequestParameters().get("username");
        val discoveryRequest = DelegatedAuthenticationDynamicDiscoveryProviderLocator.DynamicDiscoveryProviderRequest
            .builder()
            .userId(userid)
            .build();

        val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(requestContext);
        val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(requestContext);
        val webContext = new JEEContext(request, response);
        
        val client = FunctionUtils.doUnchecked(() -> selector.locate(discoveryRequest, webContext));
        if (client.isEmpty()) {
            WebUtils.addErrorMessageToContext(requestContext, "screen.pac4j.discovery.unknownclient");
            requestContext.getRequestScope().put("username", userid);
            return error();
        }
        return FunctionUtils.doUnchecked(() -> {
            configContext.getDelegatedClientIdentityProvidersProducer().produce(requestContext, client.get())
                .ifPresent(cfg -> requestContext.getRequestScope()
                    .put(DelegatedAuthenticationDynamicDiscoveryProviderLocator.REQUEST_SCOPE_ATTR_PROVIDER_REDIRECT_URL, cfg.getRedirectUrl()));
            return new Event(this, CasWebflowConstants.STATE_ID_REDIRECT,
                new LocalAttributeMap<>("client", client.get()));
        });
    }
This is {@link DelegatedClientAuthenticationDynamicDiscoveryExecutionAction}.

@author Misagh Moayyed
@since 6.5.0
support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/flow/actions/DelegatedClientAuthenticationDynamicDiscoveryExecutionAction.java