@Bean
    @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
    @ConditionalOnMissingBean(name = "mongoDbAuditTrailManager")
    public AuditTrailManager mongoDbAuditTrailManager(
        final CasConfigurationProperties casProperties,
        @Qualifier(CasSSLContext.BEAN_NAME) final CasSSLContext casSslContext) {
        val mongo = casProperties.getAudit().getMongo();
        val factory = new MongoDbConnectionFactory(List.of(new AuditActionContextConverter()), casSslContext.getSslContext());
        val mongoTemplate = factory.buildMongoTemplate(mongo);
        MongoDbConnectionFactory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
        return new MongoDbAuditTrailManager(mongoTemplate, mongo.getCollection(), mongo.isAsynchronous());
    }
This is {@link CasSupportMongoDbAuditAutoConfiguration}.

@author Misagh Moayyed
@since 5.2.0
support/cas-server-support-audit-mongo/src/main/java/org/apereo/cas/config/CasSupportMongoDbAuditAutoConfiguration.java