use of org.apereo.cas.configuration.model.core.audit.AuditMongoDbProperties in project cas by apereo.
the class CasMongoDbThrottlingConfiguration method authenticationThrottle.
@Autowired
@Bean
@RefreshScope
public ThrottledSubmissionHandlerInterceptor authenticationThrottle(@Qualifier("auditTrailExecutionPlan") final AuditTrailExecutionPlan auditTrailExecutionPlan) {
final ThrottleProperties throttle = casProperties.getAuthn().getThrottle();
final ThrottleProperties.Failure failure = throttle.getFailure();
final AuditMongoDbProperties mongo = casProperties.getAudit().getMongo();
final MongoDbConnectionFactory factory = new MongoDbConnectionFactory();
final MongoTemplate mongoTemplate = factory.buildMongoTemplate(mongo);
factory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
return new MongoDbThrottledSubmissionHandlerInterceptorAdapter(failure.getThreshold(), failure.getRangeSeconds(), throttle.getUsernameParameter(), auditTrailExecutionPlan, mongoTemplate, failure.getCode(), throttle.getAppcode(), mongo.getCollection());
}
use of org.apereo.cas.configuration.model.core.audit.AuditMongoDbProperties 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