Search in sources :

Example 36 with MongoDbConnectionFactory

use of org.apereo.cas.mongo.MongoDbConnectionFactory in project cas by apereo.

the class MongoDbEventsConfiguration method mongoEventsTemplate.

@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@Bean
@ConditionalOnMissingBean(name = "mongoEventsTemplate")
public MongoOperations mongoEventsTemplate(final CasConfigurationProperties casProperties, @Qualifier(CasSSLContext.BEAN_NAME) final CasSSLContext casSslContext) {
    val mongo = casProperties.getEvents().getMongo();
    val factory = new MongoDbConnectionFactory(casSslContext.getSslContext());
    val mongoTemplate = factory.buildMongoTemplate(mongo);
    MongoDbConnectionFactory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
    return mongoTemplate;
}
Also used : lombok.val(lombok.val) MongoDbConnectionFactory(org.apereo.cas.mongo.MongoDbConnectionFactory) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 37 with MongoDbConnectionFactory

use of org.apereo.cas.mongo.MongoDbConnectionFactory 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());
}
Also used : lombok.val(lombok.val) MongoDbConnectionFactory(org.apereo.cas.mongo.MongoDbConnectionFactory) MongoDbThrottledSubmissionHandlerInterceptorAdapter(org.apereo.cas.web.support.MongoDbThrottledSubmissionHandlerInterceptorAdapter) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Aggregations

MongoDbConnectionFactory (org.apereo.cas.mongo.MongoDbConnectionFactory)37 Bean (org.springframework.context.annotation.Bean)32 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)23 lombok.val (lombok.val)21 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)13 MongoTemplate (org.springframework.data.mongodb.core.MongoTemplate)13 SingleCollectionMongoDbProperties (org.apereo.cas.configuration.model.support.mongo.SingleCollectionMongoDbProperties)3 Test (org.junit.jupiter.api.Test)3 U2FMongoDbDeviceRepository (org.apereo.cas.adaptors.u2f.storage.U2FMongoDbDeviceRepository)2 MongoDbAuditTrailManager (org.apereo.cas.audit.MongoDbAuditTrailManager)2 AuditMongoDbProperties (org.apereo.cas.configuration.model.core.audit.AuditMongoDbProperties)2 MongoDbConsentRepository (org.apereo.cas.consent.MongoDbConsentRepository)2 OpenSamlConfigBean (org.apereo.cas.support.saml.OpenSamlConfigBean)2 MongoDbThrottledSubmissionHandlerInterceptorAdapter (org.apereo.cas.web.support.MongoDbThrottledSubmissionHandlerInterceptorAdapter)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2 JsonTypeInfo (com.fasterxml.jackson.annotation.JsonTypeInfo)1 DBCollection (com.mongodb.DBCollection)1 Serializable (java.io.Serializable)1 Date (java.util.Date)1 TimeUnit (java.util.concurrent.TimeUnit)1