@Override
    protected Event doExecuteInternal(final RequestContext requestContext) throws Exception {
        val applicationContext = requestContext.getActiveFlow().getApplicationContext();
        val authentication = WebUtils.getAuthentication(requestContext);
        val duoSecurityIdentifier = MultifactorAuthenticationWebflowUtils.getMultifactorAuthenticationProvider(requestContext);

        val duoProvider = MultifactorAuthenticationUtils.getMultifactorAuthenticationProviderById(duoSecurityIdentifier, applicationContext)
            .map(DuoSecurityMultifactorAuthenticationProvider.class::cast)
            .orElseThrow(() -> new IllegalArgumentException("Unable to locate multifactor authentication provider by id " + duoSecurityIdentifier));

        val client = getDuoSecurityClient(requestContext, duoProvider, duoSecurityIdentifier).getInstance();
        val state = client.generateState();
        val service = WebUtils.getService(requestContext);
        LOGGER.debug("Generated Duo Security state [{}] for service [{}]", state, service);

        val properties = new LinkedHashMap<String, Object>();
        properties.put("duoProviderId", duoSecurityIdentifier);
        properties.put(Authentication.class.getSimpleName(), authentication);
        properties.put(CasWebflowConstants.ATTRIBUTE_AUTHENTICATION, authentication);
        val authenticationResultBuilder = WebUtils.getAuthenticationResultBuilder(requestContext);
        properties.put(AuthenticationResultBuilder.class.getSimpleName(), authenticationResultBuilder);
        properties.put(CasWebflowConstants.ATTRIBUTE_AUTHENTICATION_RESULT_BUILDER, authenticationResultBuilder);
        val authenticationResult = WebUtils.getAuthenticationResult(requestContext);
        properties.put(AuthenticationResult.class.getSimpleName(), authenticationResult);
        properties.put(CasWebflowConstants.ATTRIBUTE_AUTHENTICATION_RESULT, authenticationResult);
        properties.put(Credential.class.getSimpleName(), MultifactorAuthenticationWebflowUtils.getMultifactorAuthenticationParentCredential(requestContext));
        FunctionUtils.doIfNotNull(service, __ -> properties.put(Service.class.getSimpleName(), service));
        properties.put(DuoSecurityAuthenticationService.class.getSimpleName(), state);

        val targetState = WebUtils.getTargetTransition(requestContext);
        FunctionUtils.doIfNotNull(targetState, __ -> properties.put(CasWebflowConstants.ATTRIBUTE_TARGET_TRANSITION, targetState));

        properties.put(FlowScope.class.getSimpleName(), requestContext.getFlowScope().asMap());
        properties.put(FlashScope.class.getSimpleName(), requestContext.getFlashScope().asMap());
        properties.put(ConversationScope.class.getSimpleName(), requestContext.getConversationScope().asMap());
        properties.put(RequestScope.class.getSimpleName(), requestContext.getRequestScope().asMap());

        Optional.ofNullable(WebUtils.getRegisteredService(requestContext))
            .ifPresent(registeredService -> properties.put(RegisteredService.class.getSimpleName(), registeredService));

        val urlWithStatePair = createAuthUrlWithState(duoProvider, properties, requestContext, state);
        requestContext.getFlowScope().put("duoUniversalPromptLoginUrl", urlWithStatePair.getLeft());

        if (!provider.getDuoAuthenticationService().getProperties().getSessionStorageType().isTicketRegistry()) {
            val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(requestContext);
            val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(requestContext);
            val context = new JEEContext(request, response);
            LOGGER.debug("Storing Duo Security session attributes [{}] into session", properties);
            val sessionStorage = duoUniversalPromptSessionStore
                .withSessionAttributes(context, properties)
                .getTrackableSession(context)
                .map(BrowserStorage.class::cast)
                .orElseThrow(() -> new IllegalStateException("Unable to determine trackable session for storage"));
            sessionStorage.setDestinationUrl(urlWithStatePair.getLeft());
            WebUtils.putBrowserStorage(requestContext, sessionStorage);
            return success(sessionStorage);
        }
        LOGGER.debug("Redirecting to Duo Security url at [{}]", urlWithStatePair);
        return success(urlWithStatePair.getRight());
    }
This is {@link DuoSecurityUniversalPromptPrepareLoginAction}.

@author Misagh Moayyed
@since 6.3.0
support/cas-server-support-duo-core/src/main/java/org/apereo/cas/adaptors/duo/web/flow/action/DuoSecurityUniversalPromptPrepareLoginAction.java