@Override
    public Resource generate() throws Exception {
        val rest = oidcProperties.getJwks().getRest();
        val exec = HttpExecutionRequest.builder()
            .basicAuthPassword(rest.getBasicAuthPassword())
            .basicAuthUsername(rest.getBasicAuthUsername())
            .method(HttpMethod.GET)
            .headers(rest.getHeaders())
            .url(rest.getUrl())
            .build();
        val response = HttpUtils.execute(exec);
        if (response == null || !HttpStatus.valueOf(response.getCode()).is2xxSuccessful()) {
            LOGGER.warn("Unable to successfully fetch JWKS resource from [{}]", rest.getUrl());
            return null;
        }

        try (val content = ((HttpEntityContainer) response).getEntity().getContent()) {
            val result = IOUtils.toString(content, StandardCharsets.UTF_8);
            LOGGER.debug("Received payload result from [{}] as [{}]", rest.getUrl(), result);
            return new ByteArrayResource(result.getBytes(StandardCharsets.UTF_8), "OIDC JWKS");
        }
    }
This is {@link OidcRestfulJsonWebKeystoreGeneratorService}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/jwks/generator/OidcRestfulJsonWebKeystoreGeneratorService.java