Search in sources :

Example 11 with MongoDbConnectionFactory

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

the class MongoDbCloudConfigBootstrapConfiguration method mongoDbCloudConfigurationTemplate.

@Bean
public MongoTemplate mongoDbCloudConfigurationTemplate() {
    final MongoDbConnectionFactory factory = new MongoDbConnectionFactory();
    final String uri = environment.getProperty("cas.spring.cloud.mongo.uri");
    return factory.buildMongoTemplate(uri);
}
Also used : MongoDbConnectionFactory(org.apereo.cas.mongo.MongoDbConnectionFactory) Bean(org.springframework.context.annotation.Bean)

Example 12 with MongoDbConnectionFactory

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

the class CasMetricsRepositoryConfiguration method mongoDbMetricWriter.

@ConditionalOnProperty(prefix = "cas.metrics.mongo", name = "collection")
@Bean
@ExportMetricWriter
public GaugeWriter mongoDbMetricWriter() {
    final MetricsProperties.MongoDb prop = casProperties.getMetrics().getMongo();
    final MongoDbConnectionFactory factory = new MongoDbConnectionFactory();
    final MongoTemplate mongoTemplate = factory.buildMongoTemplate(prop);
    return metric -> {
        final MongoDbMetric metrics = new MongoDbMetric(metric);
        mongoTemplate.save(metrics, prop.getCollection());
    };
}
Also used : CasConfigurationProperties(org.apereo.cas.configuration.CasConfigurationProperties) Getter(lombok.Getter) MongoDbConnectionFactory(org.apereo.cas.mongo.MongoDbConnectionFactory) Date(java.util.Date) Autowired(org.springframework.beans.factory.annotation.Autowired) MetricsProperties(org.apereo.cas.configuration.model.core.metrics.MetricsProperties) StatsdMetricWriter(org.springframework.boot.actuate.metrics.statsd.StatsdMetricWriter) EnableConfigurationProperties(org.springframework.boot.context.properties.EnableConfigurationProperties) ToString(lombok.ToString) ConditionalOnProperty(org.springframework.boot.autoconfigure.condition.ConditionalOnProperty) MongoTemplate(org.springframework.data.mongodb.core.MongoTemplate) MetricWriter(org.springframework.boot.actuate.metrics.writer.MetricWriter) RedisConnectionFactory(org.springframework.data.redis.connection.RedisConnectionFactory) GaugeWriter(org.springframework.boot.actuate.metrics.writer.GaugeWriter) RedisObjectFactory(org.apereo.cas.redis.core.RedisObjectFactory) RedisMetricRepository(org.springframework.boot.actuate.metrics.repository.redis.RedisMetricRepository) InfluxDbConnectionFactory(org.apereo.cas.influxdb.InfluxDbConnectionFactory) Serializable(java.io.Serializable) ExportMetricWriter(org.springframework.boot.actuate.autoconfigure.ExportMetricWriter) Configuration(org.springframework.context.annotation.Configuration) TimeUnit(java.util.concurrent.TimeUnit) Slf4j(lombok.extern.slf4j.Slf4j) JsonTypeInfo(com.fasterxml.jackson.annotation.JsonTypeInfo) Metric(org.springframework.boot.actuate.metrics.Metric) OpenTsdbGaugeWriter(org.springframework.boot.actuate.metrics.opentsdb.OpenTsdbGaugeWriter) Point(org.influxdb.dto.Point) Bean(org.springframework.context.annotation.Bean) MongoDbConnectionFactory(org.apereo.cas.mongo.MongoDbConnectionFactory) MetricsProperties(org.apereo.cas.configuration.model.core.metrics.MetricsProperties) MongoTemplate(org.springframework.data.mongodb.core.MongoTemplate) ExportMetricWriter(org.springframework.boot.actuate.autoconfigure.ExportMetricWriter) ConditionalOnProperty(org.springframework.boot.autoconfigure.condition.ConditionalOnProperty) Bean(org.springframework.context.annotation.Bean)

Example 13 with MongoDbConnectionFactory

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

the class MongoDbEventsConfiguration method mongoEventsTemplate.

@RefreshScope
@Bean
public MongoTemplate mongoEventsTemplate() {
    final EventsProperties.MongoDb mongo = casProperties.getEvents().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) EventsProperties(org.apereo.cas.configuration.model.core.events.EventsProperties) MongoTemplate(org.springframework.data.mongodb.core.MongoTemplate) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Example 14 with MongoDbConnectionFactory

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

the class GoogleAuthenticatorMongoDbConfiguration method mongoDbGoogleAuthenticatorTemplate.

@RefreshScope
@Bean
public MongoTemplate mongoDbGoogleAuthenticatorTemplate() {
    final GAuthMultifactorProperties.MongoDb mongo = casProperties.getAuthn().getMfa().getGauth().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) MongoTemplate(org.springframework.data.mongodb.core.MongoTemplate) GAuthMultifactorProperties(org.apereo.cas.configuration.model.support.mfa.GAuthMultifactorProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Example 15 with MongoDbConnectionFactory

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

the class MongoDbMultifactorAuthenticationTrustConfiguration method mongoMfaTrustedAuthnTemplate.

@RefreshScope
@Bean
public MongoTemplate mongoMfaTrustedAuthnTemplate() {
    final TrustedDevicesMultifactorProperties.MongoDb mongo = casProperties.getAuthn().getMfa().getTrusted().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) TrustedDevicesMultifactorProperties(org.apereo.cas.configuration.model.support.mfa.TrustedDevicesMultifactorProperties) 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