Search in sources :

Example 1 with FormatDnResolver

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;
}
Also used : FormatDnResolver(org.ldaptive.auth.FormatDnResolver) Authenticator(org.ldaptive.auth.Authenticator)

Example 2 with FormatDnResolver

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;
}
Also used : FormatDnResolver(org.ldaptive.auth.FormatDnResolver) Authenticator(org.ldaptive.auth.Authenticator)

Aggregations

Authenticator (org.ldaptive.auth.Authenticator)2 FormatDnResolver (org.ldaptive.auth.FormatDnResolver)2