Search in sources :

Example 1 with AuditMongoDbProperties

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());
}
Also used : MongoDbConnectionFactory(org.apereo.cas.mongo.MongoDbConnectionFactory) MongoTemplate(org.springframework.data.mongodb.core.MongoTemplate) MongoDbThrottledSubmissionHandlerInterceptorAdapter(org.apereo.cas.web.support.MongoDbThrottledSubmissionHandlerInterceptorAdapter) AuditMongoDbProperties(org.apereo.cas.configuration.model.core.audit.AuditMongoDbProperties) ThrottleProperties(org.apereo.cas.configuration.model.support.throttle.ThrottleProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Autowired(org.springframework.beans.factory.annotation.Autowired) Bean(org.springframework.context.annotation.Bean)

Example 2 with AuditMongoDbProperties

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;
}
Also used : MongoDbAuditTrailManager(org.apereo.cas.audit.MongoDbAuditTrailManager) MongoDbConnectionFactory(org.apereo.cas.mongo.MongoDbConnectionFactory) MongoTemplate(org.springframework.data.mongodb.core.MongoTemplate) AuditMongoDbProperties(org.apereo.cas.configuration.model.core.audit.AuditMongoDbProperties) Bean(org.springframework.context.annotation.Bean)

Aggregations

AuditMongoDbProperties (org.apereo.cas.configuration.model.core.audit.AuditMongoDbProperties)2 MongoDbConnectionFactory (org.apereo.cas.mongo.MongoDbConnectionFactory)2 Bean (org.springframework.context.annotation.Bean)2 MongoTemplate (org.springframework.data.mongodb.core.MongoTemplate)2 MongoDbAuditTrailManager (org.apereo.cas.audit.MongoDbAuditTrailManager)1 ThrottleProperties (org.apereo.cas.configuration.model.support.throttle.ThrottleProperties)1 MongoDbThrottledSubmissionHandlerInterceptorAdapter (org.apereo.cas.web.support.MongoDbThrottledSubmissionHandlerInterceptorAdapter)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1