use of org.apereo.cas.web.support.MongoDbThrottledSubmissionHandlerInterceptorAdapter 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.web.support.MongoDbThrottledSubmissionHandlerInterceptorAdapter in project cas by apereo.
the class CasMongoDbThrottlingConfiguration method authenticationThrottle.
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public ThrottledSubmissionHandlerInterceptor authenticationThrottle(final CasConfigurationProperties casProperties, @Qualifier("authenticationThrottlingConfigurationContext") final ThrottledSubmissionHandlerConfigurationContext authenticationThrottlingConfigurationContext, @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 MongoDbThrottledSubmissionHandlerInterceptorAdapter(authenticationThrottlingConfigurationContext, mongoTemplate, mongo.getCollection());
}
Aggregations