Search in sources :

Example 1 with MongoDbConsentRepository

use of org.apereo.cas.consent.MongoDbConsentRepository 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());
}
Also used : MongoDbConnectionFactory(org.apereo.cas.mongo.MongoDbConnectionFactory) ConsentProperties(org.apereo.cas.configuration.model.support.consent.ConsentProperties) MongoTemplate(org.springframework.data.mongodb.core.MongoTemplate) MongoDbConsentRepository(org.apereo.cas.consent.MongoDbConsentRepository) Bean(org.springframework.context.annotation.Bean)

Aggregations

ConsentProperties (org.apereo.cas.configuration.model.support.consent.ConsentProperties)1 MongoDbConsentRepository (org.apereo.cas.consent.MongoDbConsentRepository)1 MongoDbConnectionFactory (org.apereo.cas.mongo.MongoDbConnectionFactory)1 Bean (org.springframework.context.annotation.Bean)1 MongoTemplate (org.springframework.data.mongodb.core.MongoTemplate)1