@Override
    public Collection<String> getImpersonationAccounts(final String username, final Optional<? extends Service> service) {
        val properties = casProperties.getAuthn().getSurrogate().getRest();
        HttpResponse response = null;
        try {
            val exec = HttpExecutionRequest.builder()
                .basicAuthPassword(properties.getBasicAuthPassword())
                .basicAuthUsername(properties.getBasicAuthUsername())
                .method(HttpMethod.valueOf(properties.getMethod().toUpperCase(Locale.ENGLISH).trim()))
                .url(properties.getUrl())
                .parameters(CollectionUtils.wrap("principal", username))
                .headers(properties.getHeaders())
                .build();
            response = HttpUtils.execute(exec);
            try (val content = ((HttpEntityContainer) response).getEntity().getContent()) {
                val result = IOUtils.toString(content, StandardCharsets.UTF_8);
                val expectedType = MAPPER.getTypeFactory().constructParametricType(List.class, String.class);
                return MAPPER.readValue(JsonValue.readHjson(result).toString(), expectedType);
            }
        } catch (final Exception e) {
            LoggingUtils.error(LOGGER, e);
        } finally {
            HttpUtils.close(response);
        }
        return new ArrayList<>();
    }
This is {@link SurrogateRestAuthenticationService}.

@author Misagh Moayyed
@since 5.2.0
support/cas-server-support-surrogate-authentication-rest/src/main/java/org/apereo/cas/authentication/surrogate/SurrogateRestAuthenticationService.java