private boolean loadSurrogates(final RequestContext requestContext) throws Throwable {
        val credential = WebUtils.getCredential(requestContext, Credential.class);
        if (credential instanceof final MutableCredential mc) {
            val username = mc.getId();
            LOGGER.debug("Loading eligible accounts for [{}] to proxy", username);
            val service = Optional.ofNullable(WebUtils.getService(requestContext));
            val surrogates = surrogateService.getImpersonationAccounts(username, service)
                .parallelStream()
                .filter(StringUtils::isNotBlank)
                .sorted()
                .distinct()
                .collect(Collectors.toList());
            LOGGER.debug("Surrogate accounts found are [{}]", surrogates);
            if (!surrogates.isEmpty()) {
                if (!surrogates.contains(username) && !surrogateService.isWildcardedAccount(surrogates, service)) {
                    surrogates.addFirst(username);
                }
                WebUtils.putSurrogateAuthenticationAccounts(requestContext, surrogates);
                return true;
            }
            LOGGER.debug("No surrogate accounts could be located for [{}]", username);
        } else {
            LOGGER.debug("Credential is not supported for surrogate authentication");
        }
        return false;
    }
This is {@link LoadSurrogatesListAction}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-surrogate-webflow/src/main/java/org/apereo/cas/web/flow/action/LoadSurrogatesListAction.java