use of org.apereo.cas.mongo.MongoDbConnectionFactory in project cas by apereo.
the class CasAcceptableUsagePolicyMongoDbConfiguration method mongoAcceptableUsagePolicyTemplate.
@RefreshScope
@Bean
public MongoTemplate mongoAcceptableUsagePolicyTemplate() {
final AcceptableUsagePolicyProperties.MongoDb mongo = casProperties.getAcceptableUsagePolicy().getMongo();
final MongoDbConnectionFactory factory = new MongoDbConnectionFactory();
final MongoTemplate mongoTemplate = factory.buildMongoTemplate(mongo);
factory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
return mongoTemplate;
}
use of org.apereo.cas.mongo.MongoDbConnectionFactory in project cas by apereo.
the class CasConsentMongoDbConfiguration method consentRepository.
@Bean
public ConsentRepository consentRepository() {
final ConsentProperties.MongoDb mongo = casProperties.getConsent().getMongo();
final MongoDbConnectionFactory factory = new MongoDbConnectionFactory();
final MongoTemplate mongoTemplate = factory.buildMongoTemplate(mongo);
factory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
return new MongoDbConsentRepository(mongoTemplate, mongo.getCollection());
}
use of org.apereo.cas.mongo.MongoDbConnectionFactory in project cas by apereo.
the class SamlIdPMongoDbMetadataConfiguration method mongoDbSamlMetadataResolverTemplate.
@ConditionalOnMissingBean(name = "mongoDbSamlMetadataResolverTemplate")
@Bean
public MongoTemplate mongoDbSamlMetadataResolverTemplate() {
final MongoDbSamlMetadataProperties mongo = casProperties.getAuthn().getSamlIdp().getMetadata().getMongo();
final MongoDbConnectionFactory factory = new MongoDbConnectionFactory();
final MongoTemplate mongoTemplate = factory.buildMongoTemplate(mongo);
factory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
return mongoTemplate;
}
use of org.apereo.cas.mongo.MongoDbConnectionFactory in project cas by apereo.
the class U2FMongoDbConfiguration method u2fDeviceRepository.
@Bean
public U2FDeviceRepository u2fDeviceRepository() {
final U2FMultifactorProperties u2f = casProperties.getAuthn().getMfa().getU2f();
final MongoDbConnectionFactory factory = new MongoDbConnectionFactory();
final U2FMultifactorProperties.MongoDb mongoProps = u2f.getMongo();
final MongoTemplate mongoTemplate = factory.buildMongoTemplate(mongoProps);
factory.createCollection(mongoTemplate, mongoProps.getCollection(), mongoProps.isDropCollection());
final LoadingCache<String, String> requestStorage = Caffeine.newBuilder().expireAfterWrite(u2f.getExpireRegistrations(), u2f.getExpireRegistrationsTimeUnit()).build(key -> StringUtils.EMPTY);
final U2FMongoDbDeviceRepository repo = new U2FMongoDbDeviceRepository(requestStorage, mongoTemplate, u2f.getExpireRegistrations(), u2f.getExpireDevicesTimeUnit(), mongoProps.getCollection());
repo.setCipherExecutor(this.u2fRegistrationRecordCipherExecutor);
return repo;
}
use of org.apereo.cas.mongo.MongoDbConnectionFactory in project cas by apereo.
the class CasSupportMongoDbAuditConfiguration method mongoDbAuditTrailManager.
@Bean
public AuditTrailManager mongoDbAuditTrailManager() {
final AuditMongoDbProperties mongo = casProperties.getAudit().getMongo();
final MongoDbConnectionFactory factory = new MongoDbConnectionFactory();
final MongoTemplate mongoTemplate = factory.buildMongoTemplate(mongo);
factory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
final MongoDbAuditTrailManager mgmr = new MongoDbAuditTrailManager(mongoTemplate, mongo.getCollection());
mgmr.setAsynchronous(mongo.isAsynchronous());
return mgmr;
}
Aggregations