use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.ACL in project atlas by apache.
the class AtlasZookeeperSecurityPropertiesTest method shouldThrowExceptionForInvalidAclString.
@Test(expectedExceptions = IllegalArgumentException.class)
public void shouldThrowExceptionForInvalidAclString() {
ACL acl = AtlasZookeeperSecurityProperties.parseAcl("randomAcl");
fail("Should have thrown exception for null ACL string");
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.ACL in project atlas by apache.
the class AtlasZookeeperSecurityPropertiesTest method shouldReturnDefaultAclIfNullOrEmpty.
@Test
public void shouldReturnDefaultAclIfNullOrEmpty() {
ACL acl = AtlasZookeeperSecurityProperties.parseAcl(null, ZooDefs.Ids.OPEN_ACL_UNSAFE.get(0));
assertEquals(acl, ZooDefs.Ids.OPEN_ACL_UNSAFE.get(0));
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.ACL in project atlas by apache.
the class AtlasZookeeperSecurityPropertiesTest method idsWithColonsAreValid.
@Test
public void idsWithColonsAreValid() {
ACL acl = AtlasZookeeperSecurityProperties.parseAcl("auth:user:password");
assertEquals(acl.getId().getScheme(), "auth");
assertEquals(acl.getId().getId(), "user:password");
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.ACL in project atlas by apache.
the class AtlasZookeeperSecurityPropertiesTest method shouldGetAcl.
@Test
public void shouldGetAcl() {
ACL acl = AtlasZookeeperSecurityProperties.parseAcl("sasl:myclient@EXAMPLE.COM");
assertEquals(acl.getId().getScheme(), "sasl");
assertEquals(acl.getId().getId(), "myclient@EXAMPLE.COM");
assertEquals(acl.getPerms(), ZooDefs.Perms.ALL);
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.ACL in project drill by apache.
the class TestZKACL method testNonClusterDiscoveryPaths.
/**
* Test ACLs on znodes other than ones required to discover the cluster
*
* ZK libraries only supports one client instance per-machine per-server and it is cached.
* This test will fail when run after other ZK tests that setup the client in a way that will cause this test to fail
*/
@Test
public void testNonClusterDiscoveryPaths() {
try {
client.create().creatingParentsIfNeeded().forPath(drillUDFPath, udf_data);
List<ACL> remoteACLs = client.getACL().forPath(drillUDFPath);
List<ACL> desiredACLs = ((ZKACLProviderDelegate) aclProviderDelegate).aclProvider.getDrillAclForPath(drillUDFPath);
Assert.assertEquals(remoteACLs.size(), desiredACLs.size());
for (ACL remote : remoteACLs) {
boolean found = false;
for (ACL desired : desiredACLs) {
// desiredACL list is READ_ACL_UNSAFE (READ, WORLD_ANYONE) + CREATOR_ALL_ACL(ALL, AUTH)
// AUTH in CREATOR_ALL would translate to SASL, username. Hence the replacement
// Note: The username("testuser1") should match the username in java.security.auth.login.config
found = desired.toString().equals(remote.toString().replace("sasl", "auth").replace("testuser1", ""));
if (found) {
break;
}
}
Assert.assertTrue(found);
}
// check if the data can be read
byte[] actual = client.getData().forPath(drillUDFPath);
Assert.assertArrayEquals("testNonClusterDiscoveryPaths data mismatch", udf_data, actual);
} catch (Exception e) {
throw new IllegalStateException("testNonClusterDiscoveryPaths failed");
}
}
Aggregations