zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From waynesj <wayn...@gmail.com>
Subject ACL questions
Date Thu, 24 May 2012 19:31:07 GMT
Hi
   I'm delving into zookeeper and trying to wrap my head around ACL access.
As I understand from reading the ACL section of the programing guide, I s/b
able to create a znode with a set  ACLs that I can partition access to
znode with?  I'm able to create the node with an set of ACL's and verified
that the ACL's were part of the new node.

However when I try to read the znode using a client auth with read ACL it
always returns AUTH fail? I running 3.4.3 standalone, below is sample code
I was using. Did I misunderstood usage or miss something?
Thanks in advance!
Wayne

...
ZooKeeper zooKeeper = new ZooKeeper(HOSTPORT, 300, this);
zooKeeper.addAuthInfo("digest", "me:pass".getBytes());

List <ACL> aclLst = new ArrayList<ACL>();

Id id = new Id();
id.setId("someone:else");
id.setScheme("digest");
aclLst.add(new ACL( ZooDefs.Perms.READ, id));
zooKeeper.close();

ZooKeeper ownerRead = new ZooKeeper(HOSTPORT, 300, this);
ownerRead.addAuthInfo("digest", "me:pass".getBytes());
Stat nodeStat = new Stat();
byte[] nodeData = ownerRead.getData("/test", false, nodeStat); //
CREATOR_ALL_ACL works fine
ownerRead.close();

ZooKeeper authRead = new ZooKeeper(HOSTPORT, 300, this);
authRead.addAuthInfo("digest", "someone:else".getBytes());
try {
     byte[] nodeData = authRead.getData("/test", false, nodeStat);
 } catch(Exception exc) {
      Assert.fail("authRead should be allowed??");  // always fails
 }
 authRead.close();

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message