Search in sources :

Example 1 with JsonBackedComplexStubPersonAttributeDao

use of org.apereo.services.persondir.support.JsonBackedComplexStubPersonAttributeDao in project cas by apereo.

the class CasPersonDirectoryConfiguration method jsonAttributeRepositories.

@ConditionalOnMissingBean(name = "jsonAttributeRepositories")
@Bean
@RefreshScope
public List<IPersonAttributeDao> jsonAttributeRepositories() {
    final List<IPersonAttributeDao> list = new ArrayList<>();
    casProperties.getAuthn().getAttributeRepository().getJson().forEach(json -> {
        final Resource r = json.getConfig().getLocation();
        if (r != null) {
            final JsonBackedComplexStubPersonAttributeDao dao = new JsonBackedComplexStubPersonAttributeDao(r);
            dao.setOrder(json.getOrder());
            LOGGER.debug("Configured JSON attribute sources from [[{}]]", r);
            list.add(dao);
        }
    });
    return list;
}
Also used : IPersonAttributeDao(org.apereo.services.persondir.IPersonAttributeDao) ArrayList(java.util.ArrayList) Resource(org.springframework.core.io.Resource) JsonBackedComplexStubPersonAttributeDao(org.apereo.services.persondir.support.JsonBackedComplexStubPersonAttributeDao) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

ArrayList (java.util.ArrayList)1 IPersonAttributeDao (org.apereo.services.persondir.IPersonAttributeDao)1 JsonBackedComplexStubPersonAttributeDao (org.apereo.services.persondir.support.JsonBackedComplexStubPersonAttributeDao)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1 Bean (org.springframework.context.annotation.Bean)1 Resource (org.springframework.core.io.Resource)1