@Override
    public Collection<String> getImpersonationAccounts(final String username, final Optional<? extends Service> givenService) {
        return isImpersonationAllowedFor(givenService)
            ? surrogateServices.stream().map(Unchecked.function(impl -> impl.getImpersonationAccounts(username, givenService))).flatMap(Collection::stream).toList()
            : new ArrayList<>();
    }
This is {@link ChainingSurrogateAuthenticationService}.

@author Misagh Moayyed
@since 7.1.0
support/cas-server-support-surrogate-core/src/main/java/org/apereo/cas/authentication/surrogate/ChainingSurrogateAuthenticationService.java