client = (CuratorFramework) curatorClientObj; } else { client = createCuratorClient(config); servletContext.setAttribute( ZOOKEEPER_SIGNER_SECRET_PROVIDER_CURATOR_CLIENT_ATTRIBUTE, client); .forPath(path, generateZKData(generateRandomSecret(), generateRandomSecret(), null)); zkVersion = 0; LOG.info("Creating secret znode"); pullFromZK(true); long initialDelay = nextRolloverDate - System.currentTimeMillis();
@Override protected synchronized void rollSecret() { super.rollSecret(); // Try to push the information to ZooKeeper with a potential next secret. nextRolloverDate += tokenValidity; byte[][] secrets = super.getAllSecrets(); pushToZK(generateRandomSecret(), secrets[0], secrets[1]); // Pull info from ZooKeeper to get the decided next secret // passing false tells it that we don't care about most of the data pullFromZK(false); }
/** * Pushes proposed data to ZooKeeper. If a different server pushes its data * first, it gives up. * @param newSecret The new secret to use * @param currentSecret The current secret * @param previousSecret The previous secret */ private synchronized void pushToZK(byte[] newSecret, byte[] currentSecret, byte[] previousSecret) { byte[] bytes = generateZKData(newSecret, currentSecret, previousSecret); try { client.setData().withVersion(zkVersion).forPath(path, bytes); } catch (KeeperException.BadVersionException bve) { LOG.debug("Unable to push to znode; another server already did it"); } catch (Exception ex) { LOG.error("An unexpected exception occured pushing data to ZooKeeper", ex); } }
LOG.info("Connecting to ZooKeeper with SASL/Kerberos" + "and using 'sasl' ACLs"); String principal = setJaasConfiguration(config); System.setProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, JAAS_LOGIN_ENTRY_NAME);
provider.init(config, ctx, validity); } else if ("zookeeper".equals(name)) { provider = new ZKSignerSecretProvider(); provider.init(config, ctx, validity); } else {
/** * Pushes proposed data to ZooKeeper. If a different server pushes its data * first, it gives up. * @param newSecret The new secret to use * @param currentSecret The current secret * @param previousSecret The previous secret */ private synchronized void pushToZK(byte[] newSecret, byte[] currentSecret, byte[] previousSecret) { byte[] bytes = generateZKData(newSecret, currentSecret, previousSecret); try { client.setData().withVersion(zkVersion).forPath(path, bytes); } catch (KeeperException.BadVersionException bve) { LOG.debug("Unable to push to znode; another server already did it"); } catch (Exception ex) { LOG.error("An unexpected exception occurred pushing data to ZooKeeper", ex); } }
LOG.info("Connecting to ZooKeeper with SASL/Kerberos" + "and using 'sasl' ACLs"); String principal = setJaasConfiguration(config); System.setProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, JAAS_LOGIN_ENTRY_NAME);
provider.init(config, ctx, validity); } else if ("zookeeper".equals(name)) { provider = new ZKSignerSecretProvider(); provider.init(config, ctx, validity); } else {
client = (CuratorFramework) curatorClientObj; } else { client = createCuratorClient(config); servletContext.setAttribute( ZOOKEEPER_SIGNER_SECRET_PROVIDER_CURATOR_CLIENT_ATTRIBUTE, client); .forPath(path, generateZKData(generateRandomSecret(), generateRandomSecret(), null)); zkVersion = 0; LOG.info("Creating secret znode"); pullFromZK(true); long initialDelay = nextRolloverDate - System.currentTimeMillis();
@Override protected synchronized void rollSecret() { super.rollSecret(); // Try to push the information to ZooKeeper with a potential next secret. nextRolloverDate += tokenValidity; byte[][] secrets = super.getAllSecrets(); pushToZK(generateRandomSecret(), secrets[0], secrets[1]); // Pull info from ZooKeeper to get the decided next secret // passing false tells it that we don't care about most of the data pullFromZK(false); }
/** * Pushes proposed data to ZooKeeper. If a different server pushes its data * first, it gives up. * @param newSecret The new secret to use * @param currentSecret The current secret * @param previousSecret The previous secret */ private synchronized void pushToZK(byte[] newSecret, byte[] currentSecret, byte[] previousSecret) { byte[] bytes = generateZKData(newSecret, currentSecret, previousSecret); try { client.setData().withVersion(zkVersion).forPath(path, bytes); } catch (KeeperException.BadVersionException bve) { LOG.debug("Unable to push to znode; another server already did it"); } catch (Exception ex) { LOG.error("An unexpected exception occurred pushing data to ZooKeeper", ex); } }
LOG.info("Connecting to ZooKeeper with SASL/Kerberos" + "and using 'sasl' ACLs"); String principal = setJaasConfiguration(config); System.setProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, JAAS_LOGIN_ENTRY_NAME);
provider.init(config, ctx, validity); } else if ("zookeeper".equals(name)) { provider = new ZKSignerSecretProvider(); provider.init(config, ctx, validity); } else {
client = (CuratorFramework) curatorClientObj; } else { client = createCuratorClient(config); servletContext.setAttribute( ZOOKEEPER_SIGNER_SECRET_PROVIDER_CURATOR_CLIENT_ATTRIBUTE, client); .forPath(path, generateZKData(generateRandomSecret(), generateRandomSecret(), null)); zkVersion = 0; LOG.info("Creating secret znode"); pullFromZK(true); long initialDelay = nextRolloverDate - System.currentTimeMillis();
@Override protected synchronized void rollSecret() { super.rollSecret(); // Try to push the information to ZooKeeper with a potential next secret. nextRolloverDate += tokenValidity; byte[][] secrets = super.getAllSecrets(); pushToZK(generateRandomSecret(), secrets[0], secrets[1]); // Pull info from ZooKeeper to get the decided next secret // passing false tells it that we don't care about most of the data pullFromZK(false); }
/** * Pushes proposed data to ZooKeeper. If a different server pushes its data * first, it gives up. * @param newSecret The new secret to use * @param currentSecret The current secret * @param previousSecret The previous secret */ private synchronized void pushToZK(byte[] newSecret, byte[] currentSecret, byte[] previousSecret) { byte[] bytes = generateZKData(newSecret, currentSecret, previousSecret); try { client.setData().withVersion(zkVersion).forPath(path, bytes); } catch (KeeperException.BadVersionException bve) { LOG.debug("Unable to push to znode; another server already did it"); } catch (Exception ex) { LOG.error("An unexpected exception occurred pushing data to ZooKeeper", ex); } }
LOG.info("Connecting to ZooKeeper with SASL/Kerberos" + "and using 'sasl' ACLs"); String principal = setJaasConfiguration(config); System.setProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, JAAS_LOGIN_ENTRY_NAME);
provider.init(config, ctx, validity); } else if ("zookeeper".equals(name)) { provider = new ZKSignerSecretProvider(); provider.init(config, ctx, validity); } else {
client = (CuratorFramework) curatorClientObj; } else { client = createCuratorClient(config); servletContext.setAttribute( ZOOKEEPER_SIGNER_SECRET_PROVIDER_CURATOR_CLIENT_ATTRIBUTE, client); .forPath(path, generateZKData(generateRandomSecret(), generateRandomSecret(), null)); zkVersion = 0; LOG.info("Creating secret znode"); pullFromZK(true); long initialDelay = nextRolloverDate - System.currentTimeMillis();
@Override protected synchronized void rollSecret() { super.rollSecret(); // Try to push the information to ZooKeeper with a potential next secret. nextRolloverDate += tokenValidity; byte[][] secrets = super.getAllSecrets(); pushToZK(generateRandomSecret(), secrets[0], secrets[1]); // Pull info from ZooKeeper to get the decided next secret // passing false tells it that we don't care about most of the data pullFromZK(false); }