use of org.apereo.cas.configuration.model.support.ldap.LdapAuthenticationProperties in project cas by apereo.
the class CasCoreConfigurationUtilsTests method verifyMappingCollections.
@Test
public void verifyMappingCollections() {
val props = new CasConfigurationProperties();
val ldap = new LdapAuthenticationProperties();
ldap.setLdapUrl("http://localhost:1234");
ldap.setBaseDn("ou=example");
ldap.setBindDn("admin-user");
ldap.setBindCredential("admin-psw");
props.getAuthn().getLdap().add(ldap);
val filters = new SimpleFilterProvider().setFailOnUnknownId(false).addFilter(CasConfigurationProperties.class.getSimpleName(), SimpleBeanPropertyFilter.filterOutAllExcept("authn")).addFilter(AuthenticationProperties.class.getSimpleName(), SimpleBeanPropertyFilter.filterOutAllExcept("ldap"));
val map = CasCoreConfigurationUtils.asMap(props.withHolder(), filters);
assertTrue(map.keySet().stream().allMatch(key -> key.startsWith("cas.authn.ldap")));
}
use of org.apereo.cas.configuration.model.support.ldap.LdapAuthenticationProperties in project cas by apereo.
the class CasDiscoveryProfileConfiguration method availableAttributes.
@Bean
public Set<String> availableAttributes() {
final LinkedHashSet<String> attributes = new LinkedHashSet<>(0);
attributes.addAll(attributeRepository.getPossibleUserAttributeNames());
final List<LdapAuthenticationProperties> ldapProps = casProperties.getAuthn().getLdap();
if (ldapProps != null) {
ldapProps.stream().forEach(ldap -> {
attributes.addAll(transformAttributes(ldap.getPrincipalAttributeList()));
attributes.addAll(transformAttributes(ldap.getAdditionalAttributes()));
});
}
final JdbcAuthenticationProperties jdbcProps = casProperties.getAuthn().getJdbc();
if (jdbcProps != null) {
jdbcProps.getQuery().stream().forEach(jdbc -> attributes.addAll(transformAttributes(jdbc.getPrincipalAttributeList())));
}
return attributes;
}
Aggregations