use of org.apereo.cas.audit.MongoDbAuditTrailManager in project cas by apereo.
the class CasSupportMongoDbAuditConfiguration method mongoDbAuditTrailManager.
@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(casSslContext.getSslContext());
val mongoTemplate = factory.buildMongoTemplate(mongo);
MongoDbConnectionFactory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
return new MongoDbAuditTrailManager(mongoTemplate, mongo.getCollection(), mongo.isAsynchronous());
}
use of org.apereo.cas.audit.MongoDbAuditTrailManager in project cas by apereo.
the class CasSupportMongoDbAuditConfiguration method mongoDbAuditTrailManager.
@Bean
public AuditTrailManager mongoDbAuditTrailManager() {
final AuditMongoDbProperties mongo = casProperties.getAudit().getMongo();
final MongoDbConnectionFactory factory = new MongoDbConnectionFactory();
final MongoTemplate mongoTemplate = factory.buildMongoTemplate(mongo);
factory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
final MongoDbAuditTrailManager mgmr = new MongoDbAuditTrailManager(mongoTemplate, mongo.getCollection());
mgmr.setAsynchronous(mongo.isAsynchronous());
return mgmr;
}
Aggregations