Search in sources :

Example 1 with ThrottleProperties

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());
}
Also used : JdbcThrottledSubmissionHandlerInterceptorAdapter(org.apereo.cas.web.support.JdbcThrottledSubmissionHandlerInterceptorAdapter) 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 ThrottleProperties

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());
}
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 3 with ThrottleProperties

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());
}
Also used : InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapter(org.apereo.cas.web.support.InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapter) 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 4 with ThrottleProperties

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());
}
Also used : InMemoryThrottledSubmissionByIpAddressHandlerInterceptorAdapter(org.apereo.cas.web.support.InMemoryThrottledSubmissionByIpAddressHandlerInterceptorAdapter) InMemoryThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapter(org.apereo.cas.web.support.InMemoryThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapter) ThrottleProperties(org.apereo.cas.configuration.model.support.throttle.ThrottleProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Autowired(org.springframework.beans.factory.annotation.Autowired) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

ThrottleProperties (org.apereo.cas.configuration.model.support.throttle.ThrottleProperties)4 Autowired (org.springframework.beans.factory.annotation.Autowired)4 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)4 Bean (org.springframework.context.annotation.Bean)4 AuditMongoDbProperties (org.apereo.cas.configuration.model.core.audit.AuditMongoDbProperties)1 MongoDbConnectionFactory (org.apereo.cas.mongo.MongoDbConnectionFactory)1 InMemoryThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapter (org.apereo.cas.web.support.InMemoryThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapter)1 InMemoryThrottledSubmissionByIpAddressHandlerInterceptorAdapter (org.apereo.cas.web.support.InMemoryThrottledSubmissionByIpAddressHandlerInterceptorAdapter)1 InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapter (org.apereo.cas.web.support.InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapter)1 JdbcThrottledSubmissionHandlerInterceptorAdapter (org.apereo.cas.web.support.JdbcThrottledSubmissionHandlerInterceptorAdapter)1 MongoDbThrottledSubmissionHandlerInterceptorAdapter (org.apereo.cas.web.support.MongoDbThrottledSubmissionHandlerInterceptorAdapter)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 MongoTemplate (org.springframework.data.mongodb.core.MongoTemplate)1