• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PooledConnectionFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.ldaptive.pool.PooledConnectionFactory的典型用法代码示例。如果您正苦于以下问题:Java PooledConnectionFactory类的具体用法?Java PooledConnectionFactory怎么用?Java PooledConnectionFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PooledConnectionFactory类属于org.ldaptive.pool包,在下文中一共展示了PooledConnectionFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: configure

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
@Override
protected void configure() {

  Multibinder<AuthenticationHandler> handlerBinder =
      Multibinder.newSetBinder(
          binder(), com.codenvy.api.dao.authentication.AuthenticationHandler.class);
  handlerBinder.addBinding().to(LdapAuthenticationHandler.class);

  bind(Authenticator.class).toProvider(AuthenticatorProvider.class);
  bind(ConnectionFactory.class).toProvider(LdapConnectionFactoryProvider.class);
  bind(PooledConnectionFactory.class).toProvider(LdapConnectionFactoryProvider.class);

  bind(EntryResolver.class).toProvider(EntryResolverProvider.class);

  bind(DBUserLinker.class).toProvider(DBUserLinkerProvider.class);
  bind(LdapEntrySelector.class).toProvider(LdapEntrySelectorProvider.class);
  bind(LdapSynchronizer.class).asEagerSingleton();
  bind(LdapSynchronizerService.class);
  bind(LdapSynchronizerPermissionsFilter.class);
  bind(DisablePasswordOperationsFilter.class);
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:22,代码来源:LdapModule.java


示例2: AuthenticatorProvider

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
@Inject
public AuthenticatorProvider(
    PooledConnectionFactory connFactory,
    EntryResolver entryResolver,
    @NotNull @Named(BASE_DN_PROPERTY_NAME) String baseDn,
    @NotNull @Named(AUTH_TYPE_PROPERTY_NAME) String type,
    @Nullable @Named(DN_FORMAT_PROPERTY_NAME) String dnFormat,
    @Nullable @Named(USER_PASSWORD_ATTRIBUTE_PROPERTY_NAME) String userPasswordAttribute,
    @Nullable @Named(USER_FILTER_PROPERTY_NAME) String userFilter,
    @Nullable @Named(ALLOW_MULTIPLE_DNS_PROPERTY_NAME) String allowMultipleDns,
    @Nullable @Named(SUBTREE_SEARCH_PROPERTY_NAME) String subtreeSearch) {
  this.baseDn = baseDn;
  checkRequiredProperty(AUTH_TYPE_PROPERTY_NAME, type);
  this.type = AuthenticationType.valueOf(type);
  this.dnFormat = dnFormat;
  this.userPasswordAttribute = userPasswordAttribute;
  this.userFilter = userFilter;
  this.allowMultipleDns =
      isNullOrEmpty(allowMultipleDns) ? false : Boolean.valueOf(allowMultipleDns);
  this.subtreeSearch = isNullOrEmpty(subtreeSearch) ? false : Boolean.valueOf(subtreeSearch);
  this.authenticator = getAuthenticator(connFactory, entryResolver);
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:23,代码来源:AuthenticatorProvider.java


示例3: destroy

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
/**
 * Close connection pull and shut down the executor.
 */
@PreDestroy
public void destroy() {
    logger.debug("Shutting down connection pools...");
    for (final PooledConnectionFactory factory : connectionPoolMap.values()) {
        factory.getConnectionPool().close();
    }
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:11,代码来源:PoolingLdaptiveResourceCRLFetcher.java


示例4: pooledLdapConnectionFactoryMonitor

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
@Autowired
@Bean
public Monitor pooledLdapConnectionFactoryMonitor(@Qualifier("pooledConnectionFactoryMonitorExecutorService") final ExecutorService executor) {
    final MonitorProperties.Ldap ldap = casProperties.getMonitor().getLdap();
    final PooledConnectionFactory connectionFactory = Beans.newLdaptivePooledConnectionFactory(ldap);
    return new PooledLdapConnectionFactoryMonitor(executor, Long.valueOf(ldap.getMaxWait()).intValue(), connectionFactory, new SearchValidator());
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:8,代码来源:LdapMonitorConfiguration.java


示例5: PooledLdapConnectionFactoryMonitor

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
/**
 * Creates a new instance that monitors the given pooled connection factory.
 *
 * @param executorService the executor service
 * @param maxWait         the max wait
 * @param factory         Connection factory to monitor.
 * @param validator       Validates connections from the factory.
 */
public PooledLdapConnectionFactoryMonitor(final ExecutorService executorService, 
                                          final int maxWait, 
                                          final PooledConnectionFactory factory,
                                          final Validator<Connection> validator) {
    super(PooledLdapConnectionFactoryMonitor.class.getSimpleName(), executorService, maxWait);
    this.connectionFactory = factory;
    this.validator = validator;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:17,代码来源:PooledLdapConnectionFactoryMonitor.java


示例6: EntryResolverProvider

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
@Inject
public EntryResolverProvider(
    PooledConnectionFactory connFactory,
    @NotNull @Named("ldap.base_dn") String baseDn,
    @Nullable @Named("ldap.auth.user.filter") String userFilter,
    @Nullable @Named("ldap.auth.subtree_search") String subtreeSearch) {
  this.entryResolver = new PooledSearchEntryResolver();
  this.entryResolver.setBaseDn(baseDn);
  this.entryResolver.setUserFilter(userFilter);
  this.entryResolver.setSubtreeSearch(
      Strings.isNullOrEmpty(subtreeSearch) ? false : Boolean.valueOf(subtreeSearch));
  this.entryResolver.setConnectionFactory(connFactory);
  this.entryResolver.setSearchEntryHandlers(new ObjectGuidHandler());
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:15,代码来源:EntryResolverProvider.java


示例7: getAuthenticator

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
private Authenticator getAuthenticator(
    PooledConnectionFactory connFactory, EntryResolver entryResolver) {
  switch (type) {
    case AD:
      return getActiveDirectoryAuthenticator(connFactory, entryResolver);
    case DIRECT:
      return getDirectBindAuthenticator(connFactory);
    case SASL:
      return getSaslAuthenticator(connFactory);
    case ANONYMOUS:
    case AUTHENTICATED:
    default:
      return getAuthenticatedOrAnonSearchAuthenticator(connFactory, entryResolver);
  }
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:16,代码来源:AuthenticatorProvider.java


示例8: getSaslAuthenticator

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
private Authenticator getSaslAuthenticator(PooledConnectionFactory connFactory) {
  checkRequiredProperty(
      Pair.of(USER_FILTER_PROPERTY_NAME, userFilter),
      Pair.of(BASE_DN_PROPERTY_NAME, baseDn),
      Pair.of(USER_FILTER_PROPERTY_NAME, userFilter));
  final PooledSearchDnResolver resolver = new PooledSearchDnResolver();
  resolver.setBaseDn(baseDn);
  resolver.setSubtreeSearch(subtreeSearch);
  resolver.setAllowMultipleDns(allowMultipleDns);
  resolver.setConnectionFactory(connFactory);
  resolver.setUserFilter(userFilter);
  return new Authenticator(resolver, getPooledBindAuthenticationHandler(connFactory));
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:14,代码来源:AuthenticatorProvider.java


示例9: getActiveDirectoryAuthenticator

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
private Authenticator getActiveDirectoryAuthenticator(
    PooledConnectionFactory connFactory, EntryResolver entryResolver) {
  checkRequiredProperty(DN_FORMAT_PROPERTY_NAME, dnFormat);
  final FormatDnResolver resolver = new FormatDnResolver(dnFormat);
  final Authenticator authn =
      new Authenticator(resolver, getPooledBindAuthenticationHandler(connFactory));
  authn.setEntryResolver(entryResolver);
  return authn;
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:10,代码来源:AuthenticatorProvider.java


示例10: getPooledBindAuthenticationHandler

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
private PooledBindAuthenticationHandler getPooledBindAuthenticationHandler(
    PooledConnectionFactory connFactory) {
  final PooledBindAuthenticationHandler handler =
      new PooledBindAuthenticationHandler(connFactory);
  handler.setAuthenticationControls(new PasswordPolicyControl());
  return handler;
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:8,代码来源:AuthenticatorProvider.java


示例11: getPooledCompareAuthenticationHandler

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
private PooledCompareAuthenticationHandler getPooledCompareAuthenticationHandler(
    PooledConnectionFactory connFactory) {
  final PooledCompareAuthenticationHandler handler =
      new PooledCompareAuthenticationHandler(connFactory);
  checkRequiredProperty(USER_PASSWORD_ATTRIBUTE_PROPERTY_NAME, userPasswordAttribute);
  handler.setPasswordAttribute(userPasswordAttribute);
  return handler;
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:9,代码来源:AuthenticatorProvider.java


示例12: directAuth

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
@Test
public void directAuth() throws Exception {
  PooledConnectionFactory connFactory = server.getConnectionFactory();
  EntryResolver entryResolver =
      new EntryResolverProvider(
              connFactory,
              "ou=developers,dc=codenvy,dc=com", // <- base dn
              null, // <- user filter
              null)
          .get(); // <- subtree search
  Authenticator authenticator =
      new AuthenticatorProvider(
              connFactory,
              entryResolver,
              "ou=developers,dc=codenvy,dc=com", // <- base dn
              "DIRECT", // <- auth type
              "cn=%s,ou=developers,dc=codenvy,dc=com", // <- dn format
              null, // <- user password attribute
              null, // <- user filter
              null, // <- allow multiple dns
              null)
          .get(); // <- subtree search

  LdapAuthenticationHandler handler = new LdapAuthenticationHandler(authenticator, cnNormalizer);

  mustAuthenticate(handler, "mike", "mike");
  mustAuthenticate(handler, "john", "john");
  mustNotAuthenticate(handler, "brad", "brad");
  mustNotAuthenticate(handler, "ivan", "ivan");
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:31,代码来源:AuthenticationTest.java


示例13: authenticatedAuthUsingRootBaseDN

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
@Test
public void authenticatedAuthUsingRootBaseDN() {
  PooledConnectionFactory connFactory = server.getConnectionFactory();
  EntryResolver entryResolver =
      new EntryResolverProvider(
              connFactory,
              "dc=codenvy,dc=com", // <- base dn
              "cn={user}", // <- user filter
              "true")
          .get(); // <- subtree search
  Authenticator authenticator =
      new AuthenticatorProvider(
              connFactory,
              entryResolver,
              "dc=codenvy,dc=com", // <- base dn
              "AUTHENTICATED", // <- auth type
              null, // <- dn format
              null, // <- user password attribute
              "cn={user}", // <- user filter
              null, // <- allow multiple dns
              "true")
          .get(); // <- subtree search

  LdapAuthenticationHandler handler = new LdapAuthenticationHandler(authenticator, cnNormalizer);

  mustAuthenticate(handler, "mike", "mike");
  mustAuthenticate(handler, "john", "john");
  mustAuthenticate(handler, "ivan", "ivan");
  mustAuthenticate(handler, "brad", "brad");
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:31,代码来源:AuthenticationTest.java


示例14: authenticatedAuthUsingCertainBaseDn

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
@Test
public void authenticatedAuthUsingCertainBaseDn() {
  PooledConnectionFactory connFactory = server.getConnectionFactory();
  EntryResolver entryResolver =
      new EntryResolverProvider(
              connFactory,
              "ou=managers,dc=codenvy,dc=com", // <- base dn
              "(&(objectClass=inetOrgPerson)(cn={user}))", // <- user filter
              "true")
          .get(); // <- subtree search
  Authenticator authenticator =
      new AuthenticatorProvider(
              connFactory,
              entryResolver,
              "ou=managers,dc=codenvy,dc=com", // <- base dn
              "AUTHENTICATED", // <- auth type
              null, // <- dn format
              null, // <- user password attribute
              "(&(objectClass=inetOrgPerson)(cn={user}))", // <- user filter
              null, // <- allow multiple dns
              "true")
          .get(); // <- subtree search

  LdapAuthenticationHandler handler = new LdapAuthenticationHandler(authenticator, cnNormalizer);

  mustAuthenticate(handler, "ivan", "ivan");
  mustAuthenticate(handler, "brad", "brad");
  mustNotAuthenticate(handler, "mike", "mike");
  mustNotAuthenticate(handler, "john", "john");
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:31,代码来源:AuthenticationTest.java


示例15: connect

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
public void connect() {
    this.config = new ConnectionConfig();
    this.config.setLdapUrl(this.url);
    this.config.setUseSSL(this.ssl);
    this.config.setConnectionInitializer(new BindConnectionInitializer(user, new Credential(password)));
    this.pool = new BlockingConnectionPool(new DefaultConnectionFactory(this.config));
    if (!this.pool.isInitialized()) {
        this.pool.initialize();
    }
    this.connFactory = new PooledConnectionFactory(this.pool);
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:12,代码来源:LdapUtils.java


示例16: newLdaptiveSearchEntryResolver

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
/**
 * New dn resolver entry resolver.
 * Creates the necessary search entry resolver.
 *
 * @param l       the ldap settings
 * @param factory the factory
 * @return the entry resolver
 */
public static EntryResolver newLdaptiveSearchEntryResolver(final AbstractLdapAuthenticationProperties l,
                                                           final PooledConnectionFactory factory) {
    if (StringUtils.isBlank(l.getBaseDn())) {
        throw new IllegalArgumentException("To create a search entry resolver, base dn cannot be empty/blank ");
    }
    if (StringUtils.isBlank(l.getUserFilter())) {
        throw new IllegalArgumentException("To create a search entry resolver, user filter cannot be empty/blank");
    }

    final PooledSearchEntryResolver entryResolver = new PooledSearchEntryResolver();
    entryResolver.setBaseDn(l.getBaseDn());
    entryResolver.setUserFilter(l.getUserFilter());
    entryResolver.setSubtreeSearch(l.isSubtreeSearch());
    entryResolver.setConnectionFactory(factory);

    final List<SearchEntryHandler> handlers = new ArrayList<>();
    l.getSearchEntryHandlers().forEach(h -> {
        switch (h.getType()) {
            case CASE_CHANGE:
                final CaseChangeEntryHandler eh = new CaseChangeEntryHandler();
                eh.setAttributeNameCaseChange(h.getCasChange().getAttributeNameCaseChange());
                eh.setAttributeNames(h.getCasChange().getAttributeNames());
                eh.setAttributeValueCaseChange(h.getCasChange().getAttributeValueCaseChange());
                eh.setDnCaseChange(h.getCasChange().getDnCaseChange());
                handlers.add(eh);
                break;
            case DN_ATTRIBUTE_ENTRY:
                final DnAttributeEntryHandler ehd = new DnAttributeEntryHandler();
                ehd.setAddIfExists(h.getDnAttribute().isAddIfExists());
                ehd.setDnAttributeName(h.getDnAttribute().getDnAttributeName());
                handlers.add(ehd);
                break;
            case MERGE:
                final MergeAttributeEntryHandler ehm = new MergeAttributeEntryHandler();
                ehm.setAttributeNames(h.getMergeAttribute().getAttributeNames());
                ehm.setMergeAttributeName(h.getMergeAttribute().getMergeAttributeName());
                handlers.add(ehm);
                break;
            case OBJECT_GUID:
                handlers.add(new ObjectGuidHandler());
                break;
            case OBJECT_SID:
                handlers.add(new ObjectSidHandler());
                break;
            case PRIMARY_GROUP:
                final PrimaryGroupIdHandler ehp = new PrimaryGroupIdHandler();
                ehp.setBaseDn(h.getPrimaryGroupId().getBaseDn());
                ehp.setGroupFilter(h.getPrimaryGroupId().getGroupFilter());
                handlers.add(ehp);
                break;
            case RANGE_ENTRY:
                handlers.add(new RangeEntryHandler());
                break;
            case RECURSIVE_ENTRY:
                handlers.add(new RecursiveEntryHandler(h.getRecursive().getSearchAttribute(), h.getRecursive().getMergeAttributes()));
                break;
            default:
                break;
        }
    });

    if (!handlers.isEmpty()) {
        LOGGER.debug("Search entry handlers defined for the entry resolver of [{}] are [{}]", l.getLdapUrl(), handlers);
        entryResolver.setSearchEntryHandlers(handlers.toArray(new SearchEntryHandler[]{}));
    }
    return entryResolver;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:76,代码来源:Beans.java


示例17: getPooledBindAuthenticationHandler

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
private static PooledBindAuthenticationHandler getPooledBindAuthenticationHandler(final AbstractLdapAuthenticationProperties l,
                                                                                  final PooledConnectionFactory factory) {
    final PooledBindAuthenticationHandler handler = new PooledBindAuthenticationHandler(factory);
    handler.setAuthenticationControls(new PasswordPolicyControl());
    return handler;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:7,代码来源:Beans.java


示例18: getPooledCompareAuthenticationHandler

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
private static PooledCompareAuthenticationHandler getPooledCompareAuthenticationHandler(final AbstractLdapAuthenticationProperties l,
                                                                                        final PooledConnectionFactory factory) {
    final PooledCompareAuthenticationHandler handler = new PooledCompareAuthenticationHandler(factory);
    handler.setPasswordAttribute(l.getPrincipalAttributePassword());
    return handler;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:7,代码来源:Beans.java


示例19: get

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
@Override
public PooledConnectionFactory get() {
  return connFactory;
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:5,代码来源:LdapConnectionFactoryProvider.java


示例20: getDirectBindAuthenticator

import org.ldaptive.pool.PooledConnectionFactory; //导入依赖的package包/类
private Authenticator getDirectBindAuthenticator(PooledConnectionFactory connFactory) {
  checkRequiredProperty(DN_FORMAT_PROPERTY_NAME, dnFormat);
  final FormatDnResolver resolver = new FormatDnResolver(dnFormat);
  return new Authenticator(resolver, getPooledBindAuthenticationHandler(connFactory));
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:6,代码来源:AuthenticatorProvider.java



注:本文中的org.ldaptive.pool.PooledConnectionFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CacheException类代码示例发布时间:2022-05-22
下一篇:
Java QuorumPeerTestBase类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap