Java Code Examples for org.apache.zookeeper.client.ZooKeeperSaslClient

The following examples show how to use org.apache.zookeeper.client.ZooKeeperSaslClient. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: ignite   Author: apache   File: ZookeeperDiscoverySpiSaslAuthAbstractTest.java    License: Apache License 2.0 3 votes vote down vote up
/** */
protected void clearSaslSystemProperties() {
    Configuration.setConfiguration(null);

    System.clearProperty(AUTH_PROVIDER);

    System.clearProperty(SASL_CONFIG);

    System.clearProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY);
}
 
Example #2
Source Project: hbase   Author: apache   File: ZKUtil.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Log in the current zookeeper client using the given configuration
 * keys for the credential file and login principal.
 *
 * <p><strong>This is only applicable when running on secure hbase</strong>
 * On regular HBase (without security features), this will safely be ignored.
 * </p>
 *
 * @param conf The configuration data to use
 * @param keytabFileKey Property key used to configure the path to the credential file
 * @param userNameKey Property key used to configure the login principal
 * @param hostname Current hostname to use in any credentials
 * @throws IOException underlying exception from SecurityUtil.login() call
 */
public static void loginClient(Configuration conf, String keytabFileKey,
    String userNameKey, String hostname) throws IOException {
  login(conf, keytabFileKey, userNameKey, hostname,
        ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY,
        JaasConfiguration.CLIENT_KEYTAB_KERBEROS_CONFIG_NAME);
}