Search in sources :

Example 16 with MongoDbConnectionFactory

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

the class MongoDbYubiKeyConfiguration method mongoYubiKeyTemplate.

@RefreshScope
@Bean
public MongoTemplate mongoYubiKeyTemplate() {
    final YubiKeyMultifactorProperties.MongoDb mongo = casProperties.getAuthn().getMfa().getYubikey().getMongo();
    final MongoDbConnectionFactory factory = new MongoDbConnectionFactory();
    final MongoTemplate mongoTemplate = factory.buildMongoTemplate(mongo);
    factory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
    return mongoTemplate;
}
Also used : MongoDbConnectionFactory(org.apereo.cas.mongo.MongoDbConnectionFactory) YubiKeyMultifactorProperties(org.apereo.cas.configuration.model.support.mfa.YubiKeyMultifactorProperties) MongoTemplate(org.springframework.data.mongodb.core.MongoTemplate) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Aggregations

MongoDbConnectionFactory (org.apereo.cas.mongo.MongoDbConnectionFactory)16 Bean (org.springframework.context.annotation.Bean)15 MongoTemplate (org.springframework.data.mongodb.core.MongoTemplate)13 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)6 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)3 AuditMongoDbProperties (org.apereo.cas.configuration.model.core.audit.AuditMongoDbProperties)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 Getter (lombok.Getter)1 ToString (lombok.ToString)1 Slf4j (lombok.extern.slf4j.Slf4j)1 U2FMongoDbDeviceRepository (org.apereo.cas.adaptors.u2f.storage.U2FMongoDbDeviceRepository)1 MongoDbAuditTrailManager (org.apereo.cas.audit.MongoDbAuditTrailManager)1 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)1 EventsProperties (org.apereo.cas.configuration.model.core.events.EventsProperties)1 MetricsProperties (org.apereo.cas.configuration.model.core.metrics.MetricsProperties)1