/** * Initializes an authenticator using an authenticator property source. * * @param options to initialize authenticator * * @return authenticator */ protected Authenticator createAuthenticatorInternal(final Map<String, ?> options) { final Authenticator a = new Authenticator(); final AuthenticatorPropertySource source = new AuthenticatorPropertySource(a, createProperties(options)); source.initialize(); return a; }
/** * Initializes an authenticator using an authenticator property source. * * @param options to initialize authenticator * * @return authenticator */ protected Authenticator createAuthenticatorInternal(final Map<String, ?> options) { final Authenticator a = new Authenticator(); final AuthenticatorPropertySource source = new AuthenticatorPropertySource(a, createProperties(options)); source.initialize(); return a; }
/** * Initializes an authenticator using an authenticator property source. * * @param options to initialize authenticator * * @return authenticator */ protected Authenticator createAuthenticatorInternal(final Map<String, ?> options) { final Authenticator a = new Authenticator(); final AuthenticatorPropertySource source = new AuthenticatorPropertySource(a, createProperties(options)); source.initialize(); return a; }
private static Authenticator getActiveDirectoryAuthenticator(final LdapAuthenticationProperties 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)); if (l.isEnhanceWithEntryResolver()) { authn.setEntryResolver(newSearchEntryResolver(l)); } return authn; }
private static Authenticator getDirectBindAuthenticator(final LdapAuthenticationProperties 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)); if (l.isEnhanceWithEntryResolver()) { authenticator.setEntryResolver(newSearchEntryResolver(l)); } return authenticator; }
/** * Initialize an Authenticator with command line options. * * @param line parsed command line arguments * * @return authenticator that has been initialized */ protected Authenticator initAuthenticator(final CommandLine line) { final Authenticator auth = new Authenticator(); final AuthenticatorPropertySource aSource = new AuthenticatorPropertySource( auth, getPropertiesFromOptions(PropertyDomain.AUTH.value(), line)); aSource.initialize(); return auth; }
/** * Initialize an Authenticator with command line options. * * @param line parsed command line arguments * * @return authenticator that has been initialized */ protected Authenticator initAuthenticator(final CommandLine line) { final Authenticator auth = new Authenticator(); final AuthenticatorPropertySource aSource = new AuthenticatorPropertySource( auth, getPropertiesFromOptions(PropertyDomain.AUTH.value(), line)); aSource.initialize(); return auth; }
/** * Initialize an Authenticator with command line options. * * @param line parsed command line arguments * * @return authenticator that has been initialized */ protected Authenticator initAuthenticator(final CommandLine line) { final Authenticator auth = new Authenticator(); final AuthenticatorPropertySource aSource = new AuthenticatorPropertySource( auth, getPropertiesFromOptions(PropertyDomain.AUTH.value(), line)); aSource.initialize(); return auth; }
@Override public Authenticator getObject() throws Exception final Authenticator aggregateAuth = new Authenticator(); final Map<String, DnResolver> dnResolvers = new HashMap<>(); final Map<String, AuthenticationHandler> authHandlers = new HashMap<>();
private static Authenticator getAuthenticatedOrAnonSearchAuthenticator(final LdapAuthenticationProperties l) { final PooledSearchDnResolver resolver = new PooledSearchDnResolver(); resolver.setBaseDn(l.getBaseDn()); resolver.setSubtreeSearch(l.isSubtreeSearch()); resolver.setAllowMultipleDns(l.isAllowMultipleDns()); resolver.setConnectionFactory(newPooledConnectionFactory(l)); resolver.setUserFilter(l.getUserFilter()); final Authenticator auth; if (StringUtils.isBlank(l.getPrincipalAttributePassword())) { auth = new Authenticator(resolver, getPooledBindAuthenticationHandler(l)); } else { auth = new Authenticator(resolver, getPooledCompareAuthenticationHandler(l)); } if (l.isEnhanceWithEntryResolver()) { auth.setEntryResolver(newSearchEntryResolver(l)); } return auth; }
@Bean public Authenticator authenticator() { SearchDnResolver dnResolver = new SearchDnResolver(connectionFactory()); dnResolver.setBaseDn(configuration.getContextSourceBase()); dnResolver.setUserFilter(configuration.getUserSearchFilter()); dnResolver.setSubtreeSearch(true); BindAuthenticationHandler authHandler = new BindAuthenticationHandler(connectionFactory()); authHandler.setAuthenticationControls(new PasswordPolicyControl()); Authenticator auth = new Authenticator(dnResolver, authHandler); auth.setAuthenticationResponseHandlers(new PasswordPolicyAuthenticationResponseHandler()); return auth; } }
private static Authenticator getSaslAuthenticator(final LdapAuthenticationProperties l) { final PooledSearchDnResolver resolver = new PooledSearchDnResolver(); resolver.setBaseDn(l.getBaseDn()); resolver.setSubtreeSearch(l.isSubtreeSearch()); resolver.setAllowMultipleDns(l.isAllowMultipleDns()); resolver.setConnectionFactory(newPooledConnectionFactory(l)); resolver.setUserFilter(l.getUserFilter()); return new Authenticator(resolver, getPooledBindAuthenticationHandler(l)); }
handler.setConnectionFactory(pooledConnectionFactory); authenticator = new Authenticator(); authenticator.setDnResolver(dnResolver); authenticator.setAuthenticationHandler(handler);