use of org.apereo.cas.adaptors.jdbc.SearchModeSearchDatabaseAuthenticationHandler in project cas by apereo.
the class CasJdbcAuthenticationConfiguration method searchModeSearchDatabaseAuthenticationHandler.
private AuthenticationHandler searchModeSearchDatabaseAuthenticationHandler(final JdbcAuthenticationProperties.Search b) {
final SearchModeSearchDatabaseAuthenticationHandler h = new SearchModeSearchDatabaseAuthenticationHandler(b.getName(), servicesManager, jdbcPrincipalFactory(), b.getOrder(), Beans.newHickariDataSource(b), b.getFieldUser(), b.getFieldPassword(), b.getTableUsers());
h.setPasswordEncoder(Beans.newPasswordEncoder(b.getPasswordEncoder()));
h.setPrincipalNameTransformer(Beans.newPrincipalNameTransformer(b.getPrincipalTransformation()));
h.setPrincipalNameTransformer(Beans.newPrincipalNameTransformer(b.getPrincipalTransformation()));
if (searchModePasswordPolicyConfiguration != null) {
h.setPasswordPolicyConfiguration(searchModePasswordPolicyConfiguration);
}
if (StringUtils.isNotBlank(b.getCredentialCriteria())) {
final Predicate<String> predicate = Pattern.compile(b.getCredentialCriteria()).asPredicate();
h.setCredentialSelectionPredicate(credential -> predicate.test(credential.getId()));
}
LOGGER.debug("Created authentication handler [{}] to handle database url at [{}]", h.getName(), b.getUrl());
return h;
}
use of org.apereo.cas.adaptors.jdbc.SearchModeSearchDatabaseAuthenticationHandler in project cas by apereo.
the class CasJdbcAuthenticationConfiguration method jdbcAuthenticationHandlers.
@ConditionalOnMissingBean(name = "jdbcAuthenticationHandlers")
@Bean
@RefreshScope
public Collection<AuthenticationHandler> jdbcAuthenticationHandlers() {
final Collection<AuthenticationHandler> handlers = new HashSet<>();
final JdbcAuthenticationProperties jdbc = casProperties.getAuthn().getJdbc();
jdbc.getBind().forEach(b -> handlers.add(bindModeSearchDatabaseAuthenticationHandler(b)));
jdbc.getEncode().forEach(b -> handlers.add(queryAndEncodeDatabaseAuthenticationHandler(b)));
jdbc.getQuery().forEach(b -> handlers.add(queryDatabaseAuthenticationHandler(b)));
jdbc.getSearch().forEach(b -> handlers.add(searchModeSearchDatabaseAuthenticationHandler(b)));
return handlers;
}
Aggregations