@Override
    public Resource generate() throws Exception {
        val resource = determineJsonWebKeystoreResource();
        val isWatcherEnabled = oidcProperties.getJwks().getFileSystem().isWatcherEnabled();
        val clientInfo = ClientInfoHolder.getClientInfo();
        if (ResourceUtils.isFile(resource) && isWatcherEnabled && resourceWatcherService == null) {
            resourceWatcherService = new FileWatcherService(resource.getFile(),
                file -> new Consumer<File>() {
                    @Override
                    public void accept(final File file) {
                        FunctionUtils.doUnchecked(__ -> {
                            if (applicationContext.isActive()) {
                                LOGGER.info("Publishing event to broadcast change in [{}]", file);
                                applicationContext.publishEvent(new OidcJsonWebKeystoreModifiedEvent(this, file, clientInfo));
                            }
                        });
                    }
                });
            resourceWatcherService.start(resource.getFilename());
        }
        val resultingResource = generate(resource);
        applicationContext.publishEvent(new OidcJsonWebKeystoreGeneratedEvent(this, resultingResource, clientInfo));
        return resultingResource;
    }
This is {@link OidcDefaultJsonWebKeystoreGeneratorService}.

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