Search in sources :

Example 1 with MongoDbSamlMetadataProperties

use of org.apereo.cas.configuration.model.support.saml.idp.metadata.MongoDbSamlMetadataProperties 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;
}
Also used : MongoDbSamlMetadataProperties(org.apereo.cas.configuration.model.support.saml.idp.metadata.MongoDbSamlMetadataProperties) MongoDbConnectionFactory(org.apereo.cas.mongo.MongoDbConnectionFactory) MongoTemplate(org.springframework.data.mongodb.core.MongoTemplate) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) OpenSamlConfigBean(org.apereo.cas.support.saml.OpenSamlConfigBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with MongoDbSamlMetadataProperties

use of org.apereo.cas.configuration.model.support.saml.idp.metadata.MongoDbSamlMetadataProperties in project cas by apereo.

the class MongoDbSamlRegisteredServiceMetadataResolverTests method setup.

@Before
public void setup() throws Exception {
    final MongoDbSamlMetadataProperties mongo = casProperties.getAuthn().getSamlIdp().getMetadata().getMongo();
    final ClassPathResource res = new ClassPathResource("sp-metadata.xml");
    final SamlMetadataDocument md = new SamlMetadataDocument();
    md.setName("SP");
    md.setValue(IOUtils.toString(res.getInputStream(), StandardCharsets.UTF_8));
    mongoDbSamlMetadataResolverTemplate.save(md, mongo.getCollection());
}
Also used : MongoDbSamlMetadataProperties(org.apereo.cas.configuration.model.support.saml.idp.metadata.MongoDbSamlMetadataProperties) SamlMetadataDocument(org.apereo.cas.support.saml.services.idp.metadata.SamlMetadataDocument) ClassPathResource(org.springframework.core.io.ClassPathResource) Before(org.junit.Before)

Aggregations

MongoDbSamlMetadataProperties (org.apereo.cas.configuration.model.support.saml.idp.metadata.MongoDbSamlMetadataProperties)2 MongoDbConnectionFactory (org.apereo.cas.mongo.MongoDbConnectionFactory)1 OpenSamlConfigBean (org.apereo.cas.support.saml.OpenSamlConfigBean)1 SamlMetadataDocument (org.apereo.cas.support.saml.services.idp.metadata.SamlMetadataDocument)1 Before (org.junit.Before)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1 MongoTemplate (org.springframework.data.mongodb.core.MongoTemplate)1