use of org.apereo.cas.mongo.MongoDbConnectionFactory in project cas by apereo.
the class CasAcceptableUsagePolicyMongoDbConfiguration method mongoAcceptableUsagePolicyTemplate.
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@Bean
@ConditionalOnMissingBean(name = "mongoAcceptableUsagePolicyTemplate")
public MongoOperations mongoAcceptableUsagePolicyTemplate(final ConfigurableApplicationContext applicationContext, final CasConfigurationProperties casProperties, @Qualifier(CasSSLContext.BEAN_NAME) final CasSSLContext casSslContext) throws Exception {
return BeanSupplier.of(MongoOperations.class).when(AcceptableUsagePolicyRepository.CONDITION_AUP_ENABLED.given(applicationContext.getEnvironment())).supply(() -> {
val mongo = casProperties.getAcceptableUsagePolicy().getMongo();
val factory = new MongoDbConnectionFactory(casSslContext.getSslContext());
val mongoTemplate = factory.buildMongoTemplate(mongo);
MongoDbConnectionFactory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
return mongoTemplate;
}).otherwiseProxy().get();
}
use of org.apereo.cas.mongo.MongoDbConnectionFactory in project cas by apereo.
the class OidcJwksMongoDbConfiguration method mongoOidcJsonWebKeystoreTemplate.
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@Bean
@ConditionalOnMissingBean(name = "mongoOidcJsonWebKeystoreTemplate")
public MongoOperations mongoOidcJsonWebKeystoreTemplate(final ConfigurableApplicationContext applicationContext, final CasConfigurationProperties casProperties, @Qualifier(CasSSLContext.BEAN_NAME) final CasSSLContext casSslContext) {
return BeanSupplier.of(MongoOperations.class).when(CONDITION_HOST.given(applicationContext.getEnvironment())).and(CONDITION_COLLECTION.given(applicationContext.getEnvironment())).supply(() -> {
val mongo = casProperties.getAuthn().getOidc().getJwks().getMongo();
val factory = new MongoDbConnectionFactory(casSslContext.getSslContext());
val mongoTemplate = factory.buildMongoTemplate(mongo);
MongoDbConnectionFactory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
return mongoTemplate;
}).otherwiseProxy().get();
}
use of org.apereo.cas.mongo.MongoDbConnectionFactory in project cas by apereo.
the class SamlIdPMongoDbIdPMetadataConfiguration method mongoDbSamlIdPMetadataTemplate.
@ConditionalOnMissingBean(name = "mongoDbSamlIdPMetadataTemplate")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public MongoOperations mongoDbSamlIdPMetadataTemplate(final ConfigurableApplicationContext applicationContext, final CasConfigurationProperties casProperties, @Qualifier(CasSSLContext.BEAN_NAME) final CasSSLContext casSslContext) {
return BeanSupplier.of(MongoOperations.class).when(CONDITION.given(applicationContext.getEnvironment())).supply(() -> {
val idp = casProperties.getAuthn().getSamlIdp();
val mongo = idp.getMetadata().getMongo();
val factory = new MongoDbConnectionFactory(casSslContext.getSslContext());
val mongoTemplate = factory.buildMongoTemplate(mongo);
MongoDbConnectionFactory.createCollection(mongoTemplate, mongo.getIdpMetadataCollection(), mongo.isDropCollection());
return mongoTemplate;
}).otherwiseProxy().get();
}
use of org.apereo.cas.mongo.MongoDbConnectionFactory in project cas by apereo.
the class SamlIdPMongoDbRegisteredServiceMetadataConfiguration method mongoDbSamlMetadataResolverTemplate.
@ConditionalOnMissingBean(name = "mongoDbSamlMetadataResolverTemplate")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public MongoOperations mongoDbSamlMetadataResolverTemplate(final CasConfigurationProperties casProperties, @Qualifier(CasSSLContext.BEAN_NAME) final CasSSLContext casSslContext) {
val mongo = casProperties.getAuthn().getSamlIdp().getMetadata().getMongo();
val factory = new MongoDbConnectionFactory(casSslContext.getSslContext());
val mongoTemplate = factory.buildMongoTemplate(mongo);
MongoDbConnectionFactory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
return mongoTemplate;
}
use of org.apereo.cas.mongo.MongoDbConnectionFactory in project cas by apereo.
the class MongoDbYubiKeyConfiguration method mongoYubiKeyTemplate.
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@Bean
public MongoOperations mongoYubiKeyTemplate(@Qualifier(CasSSLContext.BEAN_NAME) final CasSSLContext casSslContext, final CasConfigurationProperties casProperties) {
val mongo = casProperties.getAuthn().getMfa().getYubikey().getMongo();
val factory = new MongoDbConnectionFactory(casSslContext.getSslContext());
val mongoTemplate = factory.buildMongoTemplate(mongo);
MongoDbConnectionFactory.createCollection(mongoTemplate, mongo.getCollection(), mongo.isDropCollection());
return mongoTemplate;
}
Aggregations