ZKDelegationTokenSecretManager extends AbstractDelegationTokenSecretManager<TokenIdent> { public static void setCurator(CuratorFramework curator) { CURATOR_TL.set(curator); } ZKDelegationTokenSecretManager(Configuration conf); static void setCurator(CuratorFramework curator); @Override void startThreads(); @Override void stopThreads(); @Override TokenIdent cancelToken(Token<TokenIdent> token,
      String canceller); boolean isTokenWatcherEnabled(); @VisibleForTesting ExecutorService getListenerThreadPool(); static final String ZK_CONF_PREFIX; static final String ZK_DTSM_ZK_NUM_RETRIES; static final String ZK_DTSM_ZK_SESSION_TIMEOUT; static final String ZK_DTSM_ZK_CONNECTION_TIMEOUT; static final String ZK_DTSM_ZK_SHUTDOWN_TIMEOUT; static final String ZK_DTSM_ZNODE_WORKING_PATH; static final String ZK_DTSM_ZK_AUTH_TYPE; static final String ZK_DTSM_ZK_CONNECTION_STRING; static final String ZK_DTSM_ZK_KERBEROS_KEYTAB; static final String ZK_DTSM_ZK_KERBEROS_PRINCIPAL; static final String ZK_DTSM_TOKEN_SEQNUM_BATCH_SIZE; static final String ZK_DTSM_TOKEN_WATCHER_ENABLED; static final boolean ZK_DTSM_TOKEN_WATCHER_ENABLED_DEFAULT; static final int ZK_DTSM_ZK_NUM_RETRIES_DEFAULT; static final int ZK_DTSM_ZK_SESSION_TIMEOUT_DEFAULT; static final int ZK_DTSM_ZK_CONNECTION_TIMEOUT_DEFAULT; static final int ZK_DTSM_ZK_SHUTDOWN_TIMEOUT_DEFAULT; static final String ZK_DTSM_ZNODE_WORKING_PATH_DEAFULT; static final int ZK_DTSM_TOKEN_SEQNUM_BATCH_SIZE_DEFAULT; }
@Test public void testACLs() throws Exception { DelegationTokenManager tm1; String connectString = zkServer.getConnectString(); Configuration conf = getSecretConf(connectString); RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3); String userPass = "myuser:mypass"; final ACL digestACL = new ACL(ZooDefs.Perms.ALL, new Id("digest", DigestAuthenticationProvider.generateDigest(userPass))); ACLProvider digestAclProvider = new ACLProvider() { @Override public List<ACL> getAclForPath(String path) { return getDefaultAcl(); } @Override public List<ACL> getDefaultAcl() { List<ACL> ret = new ArrayList<ACL>(); ret.add(digestACL); return ret; } }; CuratorFramework curatorFramework = CuratorFrameworkFactory.builder() .connectString(connectString) .retryPolicy(retryPolicy) .aclProvider(digestAclProvider) .authorization("digest", userPass.getBytes("UTF-8")) .build(); curatorFramework.start(); ZKDelegationTokenSecretManager.setCurator(curatorFramework); tm1 = new DelegationTokenManager(conf, new Text("bla")); tm1.init(); String workingPath = conf.get(ZKDelegationTokenSecretManager.ZK_DTSM_ZNODE_WORKING_PATH); verifyACL(curatorFramework, "/" + workingPath, digestACL); tm1.destroy(); ZKDelegationTokenSecretManager.setCurator(null); curatorFramework.close(); }