use of org.apereo.cas.configuration.model.support.throttle.ThrottleProperties in project cas by apereo.
the class CasJdbcThrottlingConfiguration method authenticationThrottle.
@Autowired
@Bean
@RefreshScope
public ThrottledSubmissionHandlerInterceptor authenticationThrottle(@Qualifier("auditTrailExecutionPlan") final AuditTrailExecutionPlan auditTrailManager) {
final ThrottleProperties throttle = casProperties.getAuthn().getThrottle();
final ThrottleProperties.Failure failure = throttle.getFailure();
return new JdbcThrottledSubmissionHandlerInterceptorAdapter(failure.getThreshold(), failure.getRangeSeconds(), throttle.getUsernameParameter(), auditTrailManager, inspektrAuditTrailDataSource(), throttle.getAppcode(), throttle.getJdbc().getAuditQuery(), failure.getCode());
}
use of org.apereo.cas.configuration.model.support.throttle.ThrottleProperties 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.support.throttle.ThrottleProperties in project cas by apereo.
the class CasJdbcThrottlingConfiguration method authenticationThrottle.
@Autowired
@Bean
@RefreshScope
public ThrottledSubmissionHandlerInterceptor authenticationThrottle(@Qualifier("auditTrailManager") final AuditTrailManager auditTrailManager) {
final ThrottleProperties throttle = casProperties.getAuthn().getThrottle();
final String appcode = throttle.getAppcode();
final String sqlQueryAudit = throttle.getJdbc().getAuditQuery();
final ThrottleProperties.Failure failure = throttle.getFailure();
return new InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapter(failure.getThreshold(), failure.getRangeSeconds(), throttle.getUsernameParameter(), auditTrailManager, inspektrAuditTrailDataSource(), appcode, sqlQueryAudit, failure.getCode());
}
use of org.apereo.cas.configuration.model.support.throttle.ThrottleProperties in project cas by apereo.
the class CasThrottlingConfiguration method authenticationThrottle.
@RefreshScope
@ConditionalOnMissingBean(name = "authenticationThrottle")
@Bean
@Autowired
public ThrottledSubmissionHandlerInterceptor authenticationThrottle(@Qualifier("auditTrailExecutionPlan") final AuditTrailExecutionPlan auditTrailExecutionPlan) {
final ThrottleProperties throttle = casProperties.getAuthn().getThrottle();
if (StringUtils.isNotBlank(throttle.getUsernameParameter())) {
LOGGER.debug("Activating authentication throttling based on IP address and username...");
return new InMemoryThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapter(throttle.getFailure().getThreshold(), throttle.getFailure().getRangeSeconds(), throttle.getUsernameParameter(), throttle.getFailure().getCode(), auditTrailExecutionPlan, throttle.getAppcode());
}
LOGGER.debug("Activating authentication throttling based on IP address...");
return new InMemoryThrottledSubmissionByIpAddressHandlerInterceptorAdapter(throttle.getFailure().getThreshold(), throttle.getFailure().getRangeSeconds(), throttle.getUsernameParameter(), throttle.getFailure().getCode(), auditTrailExecutionPlan, throttle.getAppcode());
}
Aggregations