@Override
    protected Event doExecuteInternal(final RequestContext requestContext) {
        var redirectUrl = determineUnauthorizedServiceRedirectUrl(requestContext);
        if (redirectUrl != null) {
            val url = redirectUrl.toString();
            val scriptFactory = ExecutableCompiledScriptFactory.findExecutableCompiledScriptFactory();
            if (scriptFactory.isPresent() && scriptFactory.get().isScript(url)) {
                redirectUrl = FunctionUtils.doUnchecked(() -> {
                    val registeredService = WebUtils.getRegisteredService(requestContext);
                    val applicationContext = requestContext.getActiveFlow().getApplicationContext();
                    val authentication = WebUtils.getAuthentication(requestContext);
                    val args = CollectionUtils.<String, Object>wrap("registeredService", registeredService,
                        "authentication", authentication,
                        "requestContext", requestContext,
                        "applicationContext", applicationContext,
                        "logger", LOGGER);
                    val scriptToExec = scriptResourceCacheManager.getObject().resolveScriptableResource(url);
                    scriptToExec.setBinding(args);
                    return scriptToExec.execute(args.values().toArray(), URI.class);
                });
            }
            LOGGER.debug("Redirecting to unauthorized redirect URL [{}]", redirectUrl);
            WebUtils.putUnauthorizedRedirectUrlIntoFlowScope(requestContext, redirectUrl);
        }
        return null;
    }
This is {@link RedirectUnauthorizedServiceUrlAction}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-actions-core/src/main/java/org/apereo/cas/web/flow/login/RedirectUnauthorizedServiceUrlAction.java