当前位置: 首页>>代码示例>>Java>>正文


Java KrbLoginManager类代码示例

本文整理汇总了Java中org.trustedanalytics.hadoop.kerberos.KrbLoginManager的典型用法代码示例。如果您正苦于以下问题:Java KrbLoginManager类的具体用法?Java KrbLoginManager怎么用?Java KrbLoginManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


KrbLoginManager类属于org.trustedanalytics.hadoop.kerberos包,在下文中一共展示了KrbLoginManager类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.trustedanalytics.hadoop.kerberos.KrbLoginManager; //导入依赖的package包/类
public Connection create() throws IOException {
    if (kerberosProperties.isEnabled()) {
        logger.info("Creating hbase connection with kerberos auth");
        try {
            KrbLoginManager loginManager = KrbLoginManagerFactory.getInstance()
                    .getKrbLoginManagerInstance(kerberosProperties.getKdc(), kerberosProperties.getRealm());
            Subject subject = loginManager.loginWithCredentials(kerberosProperties.getUser(),
                    kerberosProperties.getPassword().toCharArray());
            loginManager.loginInHadoop(subject, hbaseConfiguration);

            return ConnectionFactory.createConnection(hbaseConfiguration, getUserFromSubject(subject));
        } catch (LoginException e) {
            logger.error("Create hbase connection failed. Unable to authorize with kerberos credentials: "
                    + "user - {}, realm - {}, kdc - {}", kerberosProperties.getUser(), kerberosProperties.getRealm(), kerberosProperties.getKdc());
            throw new IOException(e);
        }
    } else {
        return ConnectionFactory.createConnection(hbaseConfiguration, getNoKrbUserFromSubject(hbaseConfiguration, kerberosProperties.getUser()));
    }

}
 
开发者ID:enableiot,项目名称:iotanalytics-gearpump-rule-engine,代码行数:22,代码来源:HbaseConnManager.java

示例2: getSecuredHBaseClient

import org.trustedanalytics.hadoop.kerberos.KrbLoginManager; //导入依赖的package包/类
private Admin getSecuredHBaseClient() throws InterruptedException, URISyntaxException,
    LoginException, IOException {
  LOGGER.info("Trying kerberos authentication");
  KrbLoginManager loginManager =
      KrbLoginManagerFactory.getInstance().getKrbLoginManagerInstance(
          kerberosProperties.getKdc(), kerberosProperties.getRealm());

  Subject subject =
      loginManager.loginWithCredentials(configuration.getUser(), configuration.getPassword()
          .toCharArray());
  loginManager.loginInHadoop(subject, hbaseConf);
  Configuration conf = HBaseConfiguration.create(hbaseConf);
  User user =
      UserProvider.instantiate(conf).create(UserGroupInformation.getUGIFromSubject(subject));
  Connection connection = ConnectionFactory.createConnection(conf, user);
  return connection.getAdmin();
}
 
开发者ID:trustedanalytics,项目名称:hbase-broker,代码行数:18,代码来源:HbaseConfiguration.java

示例3: create

import org.trustedanalytics.hadoop.kerberos.KrbLoginManager; //导入依赖的package包/类
public Connection create() throws IOException, LoginException {
    Configuration hbaseConfiguration = Configurations.newInstanceFromEnv().getServiceConfig(ServiceType.HBASE_TYPE).asHadoopConfiguration();
    try {
        KerberosProperties kerberosProperties = serviceConfigProvider.getKerberosCredentials();
        if (isKerberosEnabled(hbaseConfiguration)) {


            KrbLoginManager loginManager = KrbLoginManagerFactory.getInstance()
                    .getKrbLoginManagerInstance(kerberosProperties.getKdc(), kerberosProperties.getRealm());
            Subject subject = loginManager.loginWithCredentials(kerberosProperties.getUser(),
                    kerberosProperties.getPassword().toCharArray());
            loginManager.loginInHadoop(subject, hbaseConfiguration);

            return ConnectionFactory.createConnection(hbaseConfiguration, getUserFromSubject(hbaseConfiguration, subject));
        } else {
            return ConnectionFactory.createConnection(hbaseConfiguration, getNoKrbUserFromSubject(hbaseConfiguration, kerberosProperties.getUser()));
        }
    } catch (VcapEnvironmentException e) {
        throw new IOException(e);
    }

}
 
开发者ID:enableiot,项目名称:iotanalytics-backend,代码行数:23,代码来源:HbaseConnManger.java

示例4: getZKClient

import org.trustedanalytics.hadoop.kerberos.KrbLoginManager; //导入依赖的package包/类
@Bean(initMethod = "init", destroyMethod = "destroy")
@Profile(Profiles.CLOUD)
@Qualifier(Qualifiers.BROKER_INSTANCE)
public ZookeeperClient getZKClient() throws IOException, LoginException {
  if (kerberosProperties.isKerberosEnabled()) {
    LOGGER.info("Found kerberos configuration - trying to authenticate");
    KrbLoginManager loginManager =
        KrbLoginManagerFactory.getInstance().getKrbLoginManagerInstance(
            kerberosProperties.getKdc(), kerberosProperties.getRealm());
    loginManager.loginWithCredentials(config.getUser(), config.getPassword().toCharArray());
  } else {
    LOGGER.warn("kerberos configuration empty or invalid - will not try to authenticate.");
  }

  return new ZookeeperClientBuilder(config.getZkClusterHosts(), config.getUser(),
      config.getBrokerRootNode(), config.getBrokerRootNode()).build();
}
 
开发者ID:trustedanalytics,项目名称:zookeeper-broker,代码行数:18,代码来源:ZookeeperConfiguration.java

示例5: logInToKerberos

import org.trustedanalytics.hadoop.kerberos.KrbLoginManager; //导入依赖的package包/类
public Configuration logInToKerberos(Configuration hadoopConf)
    throws LoginException, IOException {
  KrbLoginManager krbLoginManager =
      KrbLoginManagerFactory.getInstance().getKrbLoginManagerInstance(kdc, realm);
  krbLoginManager.loginInHadoop(krbLoginManager.loginWithCredentials(user, password), hadoopConf);
  return hadoopConf;
}
 
开发者ID:trustedanalytics,项目名称:h2o-provisioner,代码行数:8,代码来源:KerberosClient.java

示例6: getUserSecureFileSystem

import org.trustedanalytics.hadoop.kerberos.KrbLoginManager; //导入依赖的package包/类
private FileSystem getUserSecureFileSystem()
    throws InterruptedException, URISyntaxException, LoginException, IOException {
  LOGGER.info("Trying kerberos authentication");
  KrbLoginManager loginManager = KrbLoginManagerFactory.getInstance()
      .getKrbLoginManagerInstance(kerberosProperties.getKdc(), kerberosProperties.getRealm());

  Configuration hadoopConf = getHadoopConfiguration();
  loginManager.loginInHadoop(
      loginManager.loginWithCredentials(configuration.getUser(), configuration.getPassword().toCharArray()),
      hadoopConf);
  return getFileSystemForUser(hadoopConf, configuration.getUser());
}
 
开发者ID:trustedanalytics,项目名称:hdfs-broker,代码行数:13,代码来源:HdfsConfiguration.java

示例7: getAdminSecureFileSystem

import org.trustedanalytics.hadoop.kerberos.KrbLoginManager; //导入依赖的package包/类
private FileSystem getAdminSecureFileSystem()
    throws InterruptedException, URISyntaxException, LoginException, IOException, KrbException {
  byte[] keytabFile = Base64.decodeBase64(configuration.getHdfsSuperuserKeytab());
  try (FileOutputStream fileOutputStream = new FileOutputStream(KEYTAB_FILE_PATH)) {
    fileOutputStream.write(keytabFile);
  }
  KrbLoginManager loginManager = KrbLoginManagerFactory.getInstance()
      .getKrbLoginManagerInstance(kerberosProperties.getKdc(), kerberosProperties.getRealm());

  Configuration hadoopConf = getHadoopConfiguration();
  loginManager.loginInHadoop(loginManager.loginWithKeyTab(configuration.getHdfsSuperuser(), KEYTAB_FILE_PATH),
      hadoopConf);
  return getFileSystemForUser(hadoopConf, configuration.getHdfsSuperuser());
}
 
开发者ID:trustedanalytics,项目名称:hdfs-broker,代码行数:15,代码来源:HdfsConfiguration.java

示例8: with

import org.trustedanalytics.hadoop.kerberos.KrbLoginManager; //导入依赖的package包/类
Builder with(KrbLoginManager loginManager) {
  this.loginManager = loginManager;
  return this;
}
 
开发者ID:trustedanalytics,项目名称:hive-broker,代码行数:5,代码来源:KerberosDataSource.java


注:本文中的org.trustedanalytics.hadoop.kerberos.KrbLoginManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。