@Override public Map<String, List<Object>> getPersonAttributesFromMultivaluedAttributes(final Map<String, List<Object>> attributes) { if (attributes.containsKey("username")) { val username = attributes.get("username"); if (!username.isEmpty()) { val results = new HashMap<String, List<Object>>(); val attrs = getAttributesForUser(username.get(0).toString()); LOGGER.debug("Groovy-based attributes found are [{}]", attrs); attrs.forEach((k, v) -> { val values = new ArrayList<Object>(CollectionUtils.toCollection(v)); LOGGER.debug("Adding Groovy-based attribute [{}] with value(s) [{}]", k, values); results.put(k, values); }); return results; } } return new HashMap<>(0); }
@ConditionalOnMissingBean(name = "groovyAttributeRepositories") @Bean @RefreshScope public List<IPersonAttributeDao> groovyAttributeRepositories() { val list = new ArrayList<IPersonAttributeDao>(); casProperties.getAuthn().getAttributeRepository().getGroovy().forEach(groovy -> { if (groovy.getLocation() != null) { val dao = new GroovyPersonAttributeDao(new InternalGroovyScriptDao(applicationContext, casProperties)); dao.setCaseInsensitiveUsername(groovy.isCaseInsensitive()); dao.setOrder(groovy.getOrder()); LOGGER.debug("Configured Groovy attribute sources from [{}]", groovy.getLocation()); list.add(dao); } }); return list; }