Search in sources :

Example 11 with ACLProvider

use of org.apache.curator.framework.api.ACLProvider in project incubator-atlas by apache.

the class CuratorFactory method getAclProvider.

private ACLProvider getAclProvider(HAConfiguration.ZookeeperProperties zookeeperProperties) {
    ACLProvider aclProvider = null;
    if (zookeeperProperties.hasAcl()) {
        final ACL acl = AtlasZookeeperSecurityProperties.parseAcl(zookeeperProperties.getAcl());
        LOG.info("Setting ACL for id {} with scheme {} and perms {}.", getIdForLogging(acl.getId().getScheme(), acl.getId().getId()), acl.getId().getScheme(), acl.getPerms());
        LOG.info("Current logged in user: {}", getCurrentUser());
        final List<ACL> acls = Arrays.asList(acl);
        aclProvider = new ACLProvider() {

            @Override
            public List<ACL> getDefaultAcl() {
                return acls;
            }

            @Override
            public List<ACL> getAclForPath(String path) {
                return acls;
            }
        };
    }
    return aclProvider;
}
Also used : ACLProvider(org.apache.curator.framework.api.ACLProvider) ACL(org.apache.zookeeper.data.ACL) List(java.util.List)

Aggregations

ACLProvider (org.apache.curator.framework.api.ACLProvider)11 ExponentialBackoffRetry (org.apache.curator.retry.ExponentialBackoffRetry)7 CuratorFramework (org.apache.curator.framework.CuratorFramework)6 RetryPolicy (org.apache.curator.RetryPolicy)5 ACL (org.apache.zookeeper.data.ACL)5 AuthInfo (org.apache.curator.framework.AuthInfo)4 DefaultZooKeeperClient (com.spotify.helios.servicescommon.coordination.DefaultZooKeeperClient)3 ZooKeeperClient (com.spotify.helios.servicescommon.coordination.ZooKeeperClient)3 HeliosRuntimeException (com.spotify.helios.common.HeliosRuntimeException)2 CuratorClientFactoryImpl (com.spotify.helios.servicescommon.coordination.CuratorClientFactoryImpl)2 List (java.util.List)2 DefaultACLProvider (org.apache.curator.framework.imps.DefaultACLProvider)2 Id (org.apache.zookeeper.data.Id)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 SystemClock (com.spotify.helios.common.SystemClock)1 ConfigurationException (io.dropwizard.configuration.ConfigurationException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 CuratorFrameworkFactory (org.apache.curator.framework.CuratorFrameworkFactory)1 IllegalConfigurationException (org.apache.flink.configuration.IllegalConfigurationException)1