本文整理汇总了Java中org.ldaptive.pool.PooledConnectionFactory类的典型用法代码示例。如果您正苦于以下问题:Java PooledConnectionFactory类的具体用法?Java PooledConnectionFactory怎么用?Java PooledConnectionFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PooledConnectionFactory类属于org.ldaptive.pool包,在下文中一共展示了PooledConnectionFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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());
}
示例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;
}
示例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());
}
示例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);
}
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}
示例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");
}
示例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");
}
示例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");
}
示例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);
}