Search in sources :

Example 1 with InternalGroovyScriptDao

use of org.apereo.cas.authentication.principal.resolvers.InternalGroovyScriptDao in project cas by apereo.

the class CasPersonDirectoryConfiguration method groovyAttributeRepositories.

@ConditionalOnMissingBean(name = "groovyAttributeRepositories")
@Bean
@RefreshScope
public List<IPersonAttributeDao> groovyAttributeRepositories() {
    final List<IPersonAttributeDao> list = new ArrayList<>();
    casProperties.getAuthn().getAttributeRepository().getGroovy().forEach(groovy -> {
        if (groovy.getConfig().getLocation() != null) {
            final GroovyPersonAttributeDao dao = new GroovyPersonAttributeDao(new InternalGroovyScriptDao(applicationContext, casProperties));
            dao.setCaseInsensitiveUsername(groovy.isCaseInsensitive());
            dao.setOrder(groovy.getOrder());
            LOGGER.debug("Configured Groovy attribute sources from [{}]", groovy.getConfig().getLocation());
            list.add(dao);
        }
    });
    return list;
}
Also used : IPersonAttributeDao(org.apereo.services.persondir.IPersonAttributeDao) GroovyPersonAttributeDao(org.apereo.services.persondir.support.GroovyPersonAttributeDao) ArrayList(java.util.ArrayList) InternalGroovyScriptDao(org.apereo.cas.authentication.principal.resolvers.InternalGroovyScriptDao) 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 InternalGroovyScriptDao (org.apereo.cas.authentication.principal.resolvers.InternalGroovyScriptDao)1 IPersonAttributeDao (org.apereo.services.persondir.IPersonAttributeDao)1 GroovyPersonAttributeDao (org.apereo.services.persondir.support.GroovyPersonAttributeDao)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