@GetMapping(value = {
        '/' + OidcConstants.BASE_OIDC_URL + '/' + OidcConstants.JWKS_URL,
        "/**/" + OidcConstants.JWKS_URL
    }, produces = MediaType.APPLICATION_JSON_VALUE)
    @Operation(summary = "Produces the collection of keys from the keystore",
        parameters = @Parameter(name = "state", description = "Filter keys by their state name", required = false))
    public ResponseEntity handleRequestInternal(final HttpServletRequest request,
                                                final HttpServletResponse response,
                                                @RequestParam(value = "state", required = false) final String state) {
        val webContext = new JEEContext(request, response);
        if (!getConfigurationContext().getIssuerService().validateIssuer(webContext, List.of(OidcConstants.JWKS_URL))) {
            val body = OAuth20Utils.getErrorResponseBody(OAuth20Constants.INVALID_REQUEST, "Invalid issuer");
            return new ResponseEntity<>(body, HttpStatus.BAD_REQUEST);
        }
        try {
            val resource = oidcJsonWebKeystoreGeneratorService.generate();
            val jsonWebKeySet = getJsonWebKeySet(resource);

            val servicesManager = getConfigurationContext().getServicesManager();
            servicesManager.getAllServicesOfType(OidcRegisteredService.class)
                .stream()
                .filter(service -> {
                    val serviceJwks = SpringExpressionLanguageValueResolver.getInstance().resolve(service.getJwks());
                    return StringUtils.isNotBlank(serviceJwks);
                })
                .forEach(service -> {
                    val set = OidcJsonWebKeyStoreUtils.getJsonWebKeySet(service,
                        getConfigurationContext().getApplicationContext(), Optional.empty());
                    set.ifPresent(keys -> keys.getJsonWebKeys().forEach(jsonWebKeySet::addJsonWebKey));
                });

            if (StringUtils.isNotBlank(state)) {
                jsonWebKeySet.getJsonWebKeys()
                    .removeIf(key -> {
                        val st = OidcJsonWebKeystoreRotationService.JsonWebKeyLifecycleStates.getJsonWebKeyState(key).name();
                        return !state.equalsIgnoreCase(st);
                    });
            }
            val body = jsonWebKeySet.toJson(JsonWebKey.OutputControlLevel.PUBLIC_ONLY);
            response.setContentType(MediaType.APPLICATION_JSON_VALUE);
            return new ResponseEntity<>(body, HttpStatus.OK);
        } catch (final Throwable e) {
            LoggingUtils.error(LOGGER, e);
            return new ResponseEntity<>(StringEscapeUtils.escapeHtml4(e.getMessage()), HttpStatus.BAD_REQUEST);
        }
    }
Handle request for jwk set.

@param request  the request
@param response the response
@param state    the state
@return the jwk set
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/web/controllers/jwks/OidcJwksEndpointController.java