org.apache.hadoop.hbase.HBaseTestingUtility.setupMiniKdc()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中org.apache.hadoop.hbase.HBaseTestingUtility.setupMiniKdc()方法的一些代码示例,展示了HBaseTestingUtility.setupMiniKdc()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HBaseTestingUtility.setupMiniKdc()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.HBaseTestingUtility
类名称:HBaseTestingUtility
方法名:setupMiniKdc

HBaseTestingUtility.setupMiniKdc介绍

[英]Sets up MiniKdc for testing security. Uses HBaseKerberosUtils to set the given keytab file as HBaseKerberosUtils#KRB_KEYTAB_FILE.
[中]设置MiniKdc以测试安全性。使用HBaseKerberosUtils将给定的keytab文件设置为HBaseKerberosUtils#KRB_keytab_文件。

代码示例

代码示例来源:origin: apache/hbase

private static void setUpKdcServer() throws Exception {
 KDC = UTIL.setupMiniKdc(KEYTAB_FILE);
 USERNAME = UserGroupInformation.getLoginUser().getShortUserName();
 SERVER_PRINCIPAL = USERNAME + "/" + LOCALHOST;
 HTTP_PRINCIPAL = "HTTP/" + LOCALHOST;
 KDC.createPrincipal(KEYTAB_FILE,
  SERVER_PRINCIPAL,
  HTTP_PRINCIPAL,
  USER_ADMIN + "/" + LOCALHOST,
  USER_OWNER + "/" + LOCALHOST,
  USER_RX + "/" + LOCALHOST,
  USER_RO + "/" + LOCALHOST,
  USER_XO + "/" + LOCALHOST,
  USER_NONE + "/" + LOCALHOST);
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUp() throws Exception {
 KDC = TEST_UTIL.setupMiniKdc(KEYTAB_FILE);
 PRINCIPAL = "hbase/" + HOST;
 KDC.createPrincipal(KEYTAB_FILE, PRINCIPAL);
 HBaseKerberosUtils.setPrincipalForTesting(PRINCIPAL + "@" + KDC.getRealm());
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUp() throws Exception {
 KDC = TEST_UTIL.setupMiniKdc(KEYTAB_FILE);
 PRINCIPAL = "hbase/" + HOST;
 CLIENT_NAME = "foo";
 KDC.createPrincipal(KEYTAB_FILE, PRINCIPAL, CLIENT_NAME);
 HBaseKerberosUtils.setPrincipalForTesting(PRINCIPAL + "@" + KDC.getRealm());
 HBaseKerberosUtils.setKeytabFileForTesting(KEYTAB_FILE.getAbsolutePath());
 HBaseKerberosUtils.setClientPrincipalForTesting(CLIENT_NAME + "@" + KDC.getRealm());
 HBaseKerberosUtils.setClientKeytabForTesting(KEYTAB_FILE.getAbsolutePath());
}

代码示例来源:origin: apache/hbase

@BeforeClass
public static void setUpBeforeClass() throws Exception {
 EVENT_LOOP_GROUP = new NioEventLoopGroup();
 CHANNEL_CLASS = NioSocketChannel.class;
 TEST_UTIL.getConfiguration().setInt(DFS_CLIENT_SOCKET_TIMEOUT_KEY, READ_TIMEOUT_MS);
 KDC = TEST_UTIL.setupMiniKdc(KEYTAB_FILE);
 USERNAME = UserGroupInformation.getLoginUser().getShortUserName();
 PRINCIPAL = USERNAME + "/" + HOST;
 HTTP_PRINCIPAL = "HTTP/" + HOST;
 KDC.createPrincipal(KEYTAB_FILE, PRINCIPAL, HTTP_PRINCIPAL);
 setUpKeyProvider(TEST_UTIL.getConfiguration());
 HBaseKerberosUtils.setSecuredConfiguration(TEST_UTIL.getConfiguration(),
   PRINCIPAL + "@" + KDC.getRealm(), HTTP_PRINCIPAL + "@" + KDC.getRealm());
 HBaseKerberosUtils.setSSLConfiguration(TEST_UTIL, TestSaslFanOutOneBlockAsyncDFSOutput.class);
}

代码示例来源:origin: apache/hbase

/**
 * Setup and start kerberos, hbase
 */
@BeforeClass
public static void setUp() throws Exception {
 KDC = TEST_UTIL.setupMiniKdc(KEYTAB_FILE);
 USERNAME = UserGroupInformation.getLoginUser().getShortUserName();
 PRINCIPAL = USERNAME + "/" + HOST;
 HTTP_PRINCIPAL = "HTTP/" + HOST;
 KDC.createPrincipal(KEYTAB_FILE, PRINCIPAL, HTTP_PRINCIPAL);
 TEST_UTIL.startMiniZKCluster();
 HBaseKerberosUtils.setSecuredConfiguration(TEST_UTIL.getConfiguration(),
   PRINCIPAL + "@" + KDC.getRealm(), HTTP_PRINCIPAL + "@" + KDC.getRealm());
 HBaseKerberosUtils.setSSLConfiguration(TEST_UTIL, SecureTestCluster.class);
 TEST_UTIL.getConfiguration().setStrings(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY,
   TokenProvider.class.getName());
 TEST_UTIL.startMiniDFSCluster(1);
 Path rootdir = TEST_UTIL.getDataTestDirOnTestFS("TestGenerateDelegationToken");
 FSUtils.setRootDir(TEST_UTIL.getConfiguration(), rootdir);
 CLUSTER = new LocalHBaseCluster(TEST_UTIL.getConfiguration(), 1);
 CLUSTER.startup();
}

代码示例来源:origin: apache/phoenix

KEYTAB = new File(KEYTAB_DIR, "test.keytab");
KDC = UTIL.setupMiniKdc(KEYTAB);

代码示例来源:origin: apache/phoenix

KEYTAB = new File(KEYTAB_DIR, "test.keytab");
KDC = UTIL.setupMiniKdc(KEYTAB);

代码示例来源:origin: apache/phoenix

KEYTAB = new File(KEYTAB_DIR, "test.keytab");
KDC = UTIL.setupMiniKdc(KEYTAB);

代码示例来源:origin: org.apache.hbase/hbase-server

@BeforeClass
public static void setUp() throws Exception {
 KDC = TEST_UTIL.setupMiniKdc(KEYTAB_FILE);
 PRINCIPAL = "hbase/" + HOST;
 KDC.createPrincipal(KEYTAB_FILE, PRINCIPAL);
 HBaseKerberosUtils.setPrincipalForTesting(PRINCIPAL + "@" + KDC.getRealm());
}

代码示例来源:origin: org.apache.hbase/hbase-server

@BeforeClass
public static void setUp() throws Exception {
 KDC = TEST_UTIL.setupMiniKdc(KEYTAB_FILE);
 PRINCIPAL = "hbase/" + HOST;
 KDC.createPrincipal(KEYTAB_FILE, PRINCIPAL);
 HBaseKerberosUtils.setPrincipalForTesting(PRINCIPAL + "@" + KDC.getRealm());
}

代码示例来源:origin: org.apache.hbase/hbase-server

@BeforeClass
public static void setUpBeforeClass() throws Exception {
 EVENT_LOOP_GROUP = new NioEventLoopGroup();
 CHANNEL_CLASS = NioSocketChannel.class;
 TEST_UTIL.getConfiguration().setInt(DFS_CLIENT_SOCKET_TIMEOUT_KEY, READ_TIMEOUT_MS);
 KDC = TEST_UTIL.setupMiniKdc(KEYTAB_FILE);
 USERNAME = UserGroupInformation.getLoginUser().getShortUserName();
 PRINCIPAL = USERNAME + "/" + HOST;
 HTTP_PRINCIPAL = "HTTP/" + HOST;
 KDC.createPrincipal(KEYTAB_FILE, PRINCIPAL, HTTP_PRINCIPAL);
 setUpKeyProvider(TEST_UTIL.getConfiguration());
 setHdfsSecuredConfiguration(TEST_UTIL.getConfiguration());
 HBaseKerberosUtils.setPrincipalForTesting(PRINCIPAL + "@" + KDC.getRealm());
 HBaseKerberosUtils.setSecuredConfiguration(TEST_UTIL.getConfiguration());
 UserGroupInformation.setConfiguration(TEST_UTIL.getConfiguration());
}

代码示例来源:origin: org.apache.hbase/hbase-server

/**
 * Setup and start kerberos, hbase
 */
@BeforeClass
public static void setUp() throws Exception {
 KDC = TEST_UTIL.setupMiniKdc(KEYTAB_FILE);
 USERNAME = UserGroupInformation.getLoginUser().getShortUserName();
 PRINCIPAL = USERNAME + "/" + HOST;
 HTTP_PRINCIPAL = "HTTP/" + HOST;
 KDC.createPrincipal(KEYTAB_FILE, PRINCIPAL, HTTP_PRINCIPAL);
 TEST_UTIL.startMiniZKCluster();
 HBaseKerberosUtils.setPrincipalForTesting(PRINCIPAL + "@" + KDC.getRealm());
 HBaseKerberosUtils.setSecuredConfiguration(TEST_UTIL.getConfiguration());
 setHdfsSecuredConfiguration(TEST_UTIL.getConfiguration());
 UserGroupInformation.setConfiguration(TEST_UTIL.getConfiguration());
 TEST_UTIL.getConfiguration().setStrings(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY,
   TokenProvider.class.getName());
 TEST_UTIL.startMiniDFSCluster(1);
 Path rootdir = TEST_UTIL.getDataTestDirOnTestFS("TestGenerateDelegationToken");
 FSUtils.setRootDir(TEST_UTIL.getConfiguration(), rootdir);
 CLUSTER = new LocalHBaseCluster(TEST_UTIL.getConfiguration(), 1);
 CLUSTER.startup();
}

相关文章

HBaseTestingUtility类方法