@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
    @Bean
    @ConditionalOnMissingBean(name = "mongoOidcJsonWebKeystoreTemplate")
    public MongoOperations mongoOidcJsonWebKeystoreTemplate(
        final ConfigurableApplicationContext applicationContext,
        final CasConfigurationProperties casProperties,
        @Qualifier(CasSSLContext.BEAN_NAME)
        final CasSSLContext casSslContext) {
        return BeanSupplier.of(MongoOperations.class)
            .when(CONDITION_HOST.given(applicationContext.getEnvironment()))
            .and(CONDITION_COLLECTION.given(applicationContext.getEnvironment()))
            .supply(() -> {
                val mongo = casProperties.getAuthn().getOidc().getJwks().getMongo();
                val factory = new MongoDbConnectionFactory(casSslContext.getSslContext());
                val mongoTemplate = factory.buildMongoTemplate(mongo);
                MongoDbConnectionFactory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
                return mongoTemplate;
            })
            .otherwiseProxy()
            .get();
    }
This is {@link CasOidcJwksMongoDbAutoConfiguration}.

@author Misagh Moayyed
@since 6.5.0
support/cas-server-support-oidc-mongo/src/main/java/org/apereo/cas/config/CasOidcJwksMongoDbAutoConfiguration.java