Search in sources :

Example 11 with DefaultACLProvider

use of org.apache.flink.shaded.curator5.org.apache.curator.framework.imps.DefaultACLProvider in project knox by apache.

the class CuratorClientService method createClient.

private RemoteConfigurationRegistryClient createClient(RemoteConfigurationRegistryConfig config) {
    ACLProvider aclProvider;
    if (config.isSecureRegistry()) {
        configureSasl(config);
        if (AUTH_TYPE_KERBEROS.equalsIgnoreCase(config.getAuthType()) && !config.isBackwardsCompatible()) {
            aclProvider = new SASLOwnerACLProvider(true);
        } else {
            aclProvider = new SASLOwnerACLProvider(false);
        }
    } else {
        // Clear SASL system property
        System.clearProperty(LOGIN_CONTEXT_NAME_PROPERTY);
        aclProvider = new DefaultACLProvider();
    }
    CuratorFramework client = CuratorFrameworkFactory.builder().connectString(config.getConnectionString()).retryPolicy(new ExponentialBackoffRetry(1000, 3)).aclProvider(aclProvider).build();
    client.start();
    return (new ClientAdapter(client, config));
}
Also used : ACLProvider(org.apache.curator.framework.api.ACLProvider) DefaultACLProvider(org.apache.curator.framework.imps.DefaultACLProvider) CuratorFramework(org.apache.curator.framework.CuratorFramework) ExponentialBackoffRetry(org.apache.curator.retry.ExponentialBackoffRetry) DefaultACLProvider(org.apache.curator.framework.imps.DefaultACLProvider)

Aggregations

DefaultACLProvider (org.apache.curator.framework.imps.DefaultACLProvider)10 ACLProvider (org.apache.curator.framework.api.ACLProvider)8 CuratorFramework (org.apache.curator.framework.CuratorFramework)5 ACL (org.apache.zookeeper.data.ACL)5 ZooKeeperClientConfig (org.apache.nifi.controller.cluster.ZooKeeperClientConfig)4 NiFiProperties (org.apache.nifi.util.NiFiProperties)4 Test (org.junit.Test)4 RetryPolicy (org.apache.curator.RetryPolicy)3 ExponentialBackoffRetry (org.apache.curator.retry.ExponentialBackoffRetry)3 Provides (com.google.inject.Provides)2 BoundedExponentialBackoffRetry (org.apache.curator.retry.BoundedExponentialBackoffRetry)2 IllegalConfigurationException (org.apache.flink.configuration.IllegalConfigurationException)2 CompletedCheckpoint (org.apache.flink.runtime.checkpoint.CompletedCheckpoint)2 LazySingleton (io.druid.guice.LazySingleton)1 Lifecycle (io.druid.java.util.common.lifecycle.Lifecycle)1 SuppressForbidden (io.netty.util.SuppressForbidden)1 IOException (java.io.IOException)1 CuratorFrameworkFactory (org.apache.curator.framework.CuratorFrameworkFactory)1 LazySingleton (org.apache.druid.guice.LazySingleton)1 Lifecycle (org.apache.druid.java.util.common.lifecycle.Lifecycle)1