org.apache.directory.server.kerberos.shared.keytab.Keytab.read()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(108)

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

Keytab.read介绍

暂无

代码示例

代码示例来源:origin: com.hortonworks.registries/common-auth

/**
 * Get all the unique principals present in the keytabfile.
 *
 * @param keytabFileName
 *          Name of the keytab file to be read.
 * @return list of unique principals in the keytab.
 * @throws IOException
 *          If keytab entries cannot be read from the file.
 */
static final String[] getPrincipalNames(String keytabFileName) throws IOException {
  Keytab keytab = Keytab.read(new File(keytabFileName));
  Set<String> principals = new HashSet<String>();
  List<KeytabEntry> entries = keytab.getEntries();
  for (KeytabEntry entry : entries) {
    principals.add(entry.getPrincipalName().replace("\\", "/"));
  }
  return principals.toArray(new String[0]);
}

代码示例来源:origin: io.hops/hadoop-auth

/**
 * Get all the unique principals present in the keytabfile.
 * 
 * @param keytabFileName 
 *          Name of the keytab file to be read.
 * @return list of unique principals in the keytab.
 * @throws IOException 
 *          If keytab entries cannot be read from the file.
 */
static final String[] getPrincipalNames(String keytabFileName) throws IOException {
  Keytab keytab = Keytab.read(new File(keytabFileName));
  Set<String> principals = new HashSet<String>();
  List<KeytabEntry> entries = keytab.getEntries();
  for (KeytabEntry entry: entries){
   principals.add(entry.getPrincipalName().replace("\\", "/"));
  }
  return principals.toArray(new String[0]);
 }

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * Get all the unique principals present in the keytabfile.
 * 
 * @param keytabFileName 
 *          Name of the keytab file to be read.
 * @return list of unique principals in the keytab.
 * @throws IOException 
 *          If keytab entries cannot be read from the file.
 */
static final String[] getPrincipalNames(String keytabFileName) throws IOException {
  Keytab keytab = Keytab.read(new File(keytabFileName));
  Set<String> principals = new HashSet<String>();
  List<KeytabEntry> entries = keytab.getEntries();
  for (KeytabEntry entry: entries){
   principals.add(entry.getPrincipalName().replace("\\", "/"));
  }
  return principals.toArray(new String[0]);
 }

代码示例来源:origin: com.github.jiayuhan-it/hadoop-auth

/**
 * Get all the unique principals present in the keytabfile.
 * 
 * @param keytabFileName 
 *          Name of the keytab file to be read.
 * @return list of unique principals in the keytab.
 * @throws IOException 
 *          If keytab entries cannot be read from the file.
 */
static final String[] getPrincipalNames(String keytabFileName) throws IOException {
  Keytab keytab = Keytab.read(new File(keytabFileName));
  Set<String> principals = new HashSet<String>();
  List<KeytabEntry> entries = keytab.getEntries();
  for (KeytabEntry entry: entries){
   principals.add(entry.getPrincipalName().replace("\\", "/"));
  }
  return principals.toArray(new String[0]);
 }

代码示例来源:origin: apache/hadoop-common

/**
 * Get all the unique principals present in the keytabfile.
 * 
 * @param keytabFileName 
 *          Name of the keytab file to be read.
 * @return list of unique principals in the keytab.
 * @throws IOException 
 *          If keytab entries cannot be read from the file.
 */
static final String[] getPrincipalNames(String keytabFileName) throws IOException {
  Keytab keytab = Keytab.read(new File(keytabFileName));
  Set<String> principals = new HashSet<String>();
  List<KeytabEntry> entries = keytab.getEntries();
  for (KeytabEntry entry: entries){
   principals.add(entry.getPrincipalName().replace("\\", "/"));
  }
  return principals.toArray(new String[0]);
 }

代码示例来源:origin: hopshadoop/hops

/**
 * Get all the unique principals present in the keytabfile.
 * 
 * @param keytabFileName 
 *          Name of the keytab file to be read.
 * @return list of unique principals in the keytab.
 * @throws IOException 
 *          If keytab entries cannot be read from the file.
 */
static final String[] getPrincipalNames(String keytabFileName) throws IOException {
  Keytab keytab = Keytab.read(new File(keytabFileName));
  Set<String> principals = new HashSet<String>();
  List<KeytabEntry> entries = keytab.getEntries();
  for (KeytabEntry entry: entries){
   principals.add(entry.getPrincipalName().replace("\\", "/"));
  }
  return principals.toArray(new String[0]);
 }

代码示例来源:origin: hortonworks/registry

/**
 * Get all the unique principals present in the keytabfile.
 *
 * @param keytabFileName
 *          Name of the keytab file to be read.
 * @return list of unique principals in the keytab.
 * @throws IOException
 *          If keytab entries cannot be read from the file.
 */
static final String[] getPrincipalNames(String keytabFileName) throws IOException {
  Keytab keytab = Keytab.read(new File(keytabFileName));
  Set<String> principals = new HashSet<String>();
  List<KeytabEntry> entries = keytab.getEntries();
  for (KeytabEntry entry : entries) {
    principals.add(entry.getPrincipalName().replace("\\", "/"));
  }
  return principals.toArray(new String[0]);
}

代码示例来源:origin: io.hops/hadoop-common

/**
 * Dump a keytab: list all principals.
 *
 * @param keytabFile the keytab file
 * @throws IOException IO problems
 */
private void dumpKeytab(File keytabFile) throws IOException {
 title("Examining keytab %s", keytabFile);
 File kt = keytabFile.getCanonicalFile();
 verifyFileIsValid(kt, CAT_KERBEROS, "keytab");
 List<KeytabEntry> entries = Keytab.read(kt).getEntries();
 println("keytab entry count: %d", entries.size());
 for (KeytabEntry entry : entries) {
  EncryptionKey key = entry.getKey();
  println(" %s: version=%d expires=%s encryption=%s",
    entry.getPrincipalName(),
    entry.getKeyVersion(),
    entry.getTimeStamp(),
    key.getKeyType());
 }
 endln();
}

相关文章