Hi,

I am using SASL Kerberos based authentication between Zookeeper and
Curator. Is below the correct way to create client with SASL authentication
?

       CuratorFrameworkFactory.Builder builder =

            CuratorFrameworkFactory.builder().connectString(coordinatorHosts
).retryPolicy(retryPolicy)

            .connectionTimeoutMs(coordinatorConnectionTimeout
).sessionTimeoutMs(coordinatorSessionTimeout);


        final CuratorFramework curatorFramework =

            builder.authorization("sasl", "zkcli...@example.com"
.getBytes()).aclProvider(new ACLProvider() {

            @Override

            public List<ACL> getDefaultAcl() {

                return ZooDefs.Ids.CREATOR_ALL_ACL;

            }


            @Override

            public List<ACL> getAclForPath(String path) {

                return ZooDefs.Ids.CREATOR_ALL_ACL;

            }

        }).build();

        curatorFramework.start();

        curatorFramework.create().withMode(CreateMode.CONTAINER).forPath(
"/MyNode");


Thanks

Reply via email to