use of org.ldaptive.auth.FormatDnResolver in project cas by apereo.
the class Beans method getActiveDirectoryAuthenticator.
private static Authenticator getActiveDirectoryAuthenticator(final AbstractLdapAuthenticationProperties l) {
if (StringUtils.isBlank(l.getDnFormat())) {
throw new IllegalArgumentException("Dn format cannot be empty/blank for active directory authentication");
}
final FormatDnResolver resolver = new FormatDnResolver(l.getDnFormat());
final Authenticator authn = new Authenticator(resolver, getPooledBindAuthenticationHandler(l, Beans.newLdaptivePooledConnectionFactory(l)));
if (l.isEnhanceWithEntryResolver()) {
authn.setEntryResolver(Beans.newLdaptiveSearchEntryResolver(l, Beans.newLdaptivePooledConnectionFactory(l)));
}
return authn;
}
use of org.ldaptive.auth.FormatDnResolver in project cas by apereo.
the class Beans method getDirectBindAuthenticator.
private static Authenticator getDirectBindAuthenticator(final AbstractLdapAuthenticationProperties l) {
if (StringUtils.isBlank(l.getDnFormat())) {
throw new IllegalArgumentException("Dn format cannot be empty/blank for direct bind authentication");
}
final FormatDnResolver resolver = new FormatDnResolver(l.getDnFormat());
final Authenticator authenticator = new Authenticator(resolver, getPooledBindAuthenticationHandler(l, Beans.newLdaptivePooledConnectionFactory(l)));
if (l.isEnhanceWithEntryResolver()) {
authenticator.setEntryResolver(Beans.newLdaptiveSearchEntryResolver(l, Beans.newLdaptivePooledConnectionFactory(l)));
}
return authenticator;
}
Aggregations