use of org.apache.zookeeper.data.Id in project zookeeper by apache.
the class ReconfigExceptionTest method testReconfigEnabledWithAuthAndACL.
@Test(timeout = 10000)
public void testReconfigEnabledWithAuthAndACL() throws InterruptedException {
resetZKAdmin();
try {
zkAdmin.addAuthInfo("digest", "super:test".getBytes());
ArrayList<ACL> acls = new ArrayList<ACL>(Collections.singletonList(new ACL(ZooDefs.Perms.WRITE, new Id("digest", "user:tl+z3z0vO6PfPfEENfLF96E6pM0="))));
zkAdmin.setACL(ZooDefs.CONFIG_NODE, acls, -1);
resetZKAdmin();
zkAdmin.addAuthInfo("digest", "user:test".getBytes());
Assert.assertTrue(reconfigPort());
} catch (KeeperException e) {
Assert.fail("Reconfig should not fail, but failed with exception : " + e.getMessage());
}
}
use of org.apache.zookeeper.data.Id in project zookeeper by apache.
the class SaslSuperUserTest method setupStatic.
@BeforeClass
public static void setupStatic() throws Exception {
oldAuthProvider = System.setProperty("zookeeper.authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider");
File tmpDir = createTmpDir();
File saslConfFile = new File(tmpDir, "jaas.conf");
FileWriter fwriter = new FileWriter(saslConfFile);
fwriter.write("" + "Server {\n" + " org.apache.zookeeper.server.auth.DigestLoginModule required\n" + " user_super_duper=\"test\";\n" + "};\n" + "Client {\n" + " org.apache.zookeeper.server.auth.DigestLoginModule required\n" + " username=\"super_duper\"\n" + " password=\"test\";\n" + "};" + "\n");
fwriter.close();
oldLoginConfig = System.setProperty("java.security.auth.login.config", saslConfFile.getAbsolutePath());
oldSuperUser = System.setProperty("zookeeper.superUser", "super_duper");
otherDigestUser = new Id("digest", DigestAuthenticationProvider.generateDigest("jack:jack"));
}
Aggregations