@Bean
    @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
    public SamlIdPMetadataLocator samlIdPMetadataLocator(
        final ConfigurableApplicationContext applicationContext,
        final CasConfigurationProperties casProperties,
        @Qualifier("samlIdPMetadataCache")
        final Cache<String, SamlIdPMetadataDocument> samlIdPMetadataCache,
        @Qualifier("samlIdPMetadataGeneratorCipherExecutor")
        final CipherExecutor samlIdPMetadataGeneratorCipherExecutor,
        @Qualifier("mongoDbSamlIdPMetadataTemplate")
        final MongoOperations mongoDbSamlIdPMetadataTemplate) {
        return BeanSupplier.of(SamlIdPMetadataLocator.class)
            .when(CONDITION.given(applicationContext.getEnvironment()))
            .supply(() -> {
                val idp = casProperties.getAuthn().getSamlIdp();
                return new MongoDbSamlIdPMetadataLocator(samlIdPMetadataGeneratorCipherExecutor,
                    samlIdPMetadataCache, mongoDbSamlIdPMetadataTemplate,
                    applicationContext,
                    idp.getMetadata().getMongo().getIdpMetadataCollection());
            })
            .otherwiseProxy()
            .get();
    }
This is {@link SamlIdPMongoDbIdPMetadataConfiguration}.

@author Misagh Moayyed
@since 5.2.0
support/cas-server-support-saml-idp-metadata-mongo/src/main/java/org/apereo/cas/config/SamlIdPMongoDbIdPMetadataConfiguration.java