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

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

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

Keytab.<init>介绍

暂无

代码示例

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

/**
  * Creates  multiple principals in the KDC and adds them to a keytab file.
  *
  * @param keytabFile keytab file to add the created principal.s
  * @param principals principals to add to the KDC, do not include the domain.
  * @throws Exception thrown if the principals or the keytab file could not be
  * created.
  */
 public void createPrincipal(File keytabFile, String ... principals)
     throws Exception {
  String generatedPassword = UUID.randomUUID().toString();
  Keytab keytab = new Keytab();
  List<KeytabEntry> entries = new ArrayList<KeytabEntry>();
  for (String principal : principals) {
   createPrincipal(principal, generatedPassword);
   principal = principal + "@" + getRealm();
   KerberosTime timestamp = new KerberosTime();
   for (Map.Entry<EncryptionType, EncryptionKey> entry : KerberosKeyFactory
       .getKerberosKeys(principal, generatedPassword).entrySet()) {
    EncryptionKey ekey = entry.getValue();
    byte keyVersion = (byte) ekey.getKeyVersion();
    entries.add(new KeytabEntry(principal, 1L, timestamp, keyVersion,
        ekey));
   }
  }
  keytab.setEntries(entries);
  keytab.write(keytabFile);
 }
}

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

/**
  * Creates  multiple principals in the KDC and adds them to a keytab file.
  *
  * @param keytabFile keytab file to add the created principal.s
  * @param principals principals to add to the KDC, do not include the domain.
  * @throws Exception thrown if the principals or the keytab file could not be
  * created.
  */
 public void createPrincipal(File keytabFile, String ... principals)
     throws Exception {
  String generatedPassword = UUID.randomUUID().toString();
  Keytab keytab = new Keytab();
  List<KeytabEntry> entries = new ArrayList<KeytabEntry>();
  for (String principal : principals) {
   createPrincipal(principal, generatedPassword);
   principal = principal + "@" + getRealm();
   KerberosTime timestamp = new KerberosTime();
   for (Map.Entry<EncryptionType, EncryptionKey> entry : KerberosKeyFactory
       .getKerberosKeys(principal, generatedPassword).entrySet()) {
    EncryptionKey ekey = entry.getValue();
    byte keyVersion = (byte) ekey.getKeyVersion();
    entries.add(new KeytabEntry(principal, 1L, timestamp, keyVersion,
        ekey));
   }
  }
  keytab.setEntries(entries);
  keytab.write(keytabFile);
 }
}

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

/**
  * Creates  multiple principals in the KDC and adds them to a keytab file.
  *
  * @param keytabFile keytab file to add the created principal.s
  * @param principals principals to add to the KDC, do not include the domain.
  * @throws Exception thrown if the principals or the keytab file could not be
  * created.
  */
 public void createPrincipal(File keytabFile, String ... principals)
     throws Exception {
  String generatedPassword = UUID.randomUUID().toString();
  Keytab keytab = new Keytab();
  List<KeytabEntry> entries = new ArrayList<KeytabEntry>();
  for (String principal : principals) {
   createPrincipal(principal, generatedPassword);
   principal = principal + "@" + getRealm();
   KerberosTime timestamp = new KerberosTime();
   for (Map.Entry<EncryptionType, EncryptionKey> entry : KerberosKeyFactory
       .getKerberosKeys(principal, generatedPassword).entrySet()) {
    EncryptionKey ekey = entry.getValue();
    byte keyVersion = (byte) ekey.getKeyVersion();
    entries.add(new KeytabEntry(principal, 1L, timestamp, keyVersion,
        ekey));
   }
  }
  keytab.setEntries(entries);
  keytab.write(keytabFile);
 }
}

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

/**
  * Creates  multiple principals in the KDC and adds them to a keytab file.
  *
  * @param keytabFile keytab file to add the created principal.s
  * @param principals principals to add to the KDC, do not include the domain.
  * @throws Exception thrown if the principals or the keytab file could not be
  * created.
  */
 public void createPrincipal(File keytabFile, String ... principals)
     throws Exception {
  String generatedPassword = UUID.randomUUID().toString();
  Keytab keytab = new Keytab();
  List<KeytabEntry> entries = new ArrayList<KeytabEntry>();
  for (String principal : principals) {
   createPrincipal(principal, generatedPassword);
   principal = principal + "@" + getRealm();
   KerberosTime timestamp = new KerberosTime();
   for (Map.Entry<EncryptionType, EncryptionKey> entry : KerberosKeyFactory
       .getKerberosKeys(principal, generatedPassword).entrySet()) {
    EncryptionKey ekey = entry.getValue();
    byte keyVersion = (byte) ekey.getKeyVersion();
    entries.add(new KeytabEntry(principal, 1L, timestamp, keyVersion,
        ekey));
   }
  }
  keytab.setEntries(entries);
  keytab.write(keytabFile);
 }
}

代码示例来源:origin: apache/activemq-artemis

public void createPrincipal(File keytabFile, String... principals) throws Exception {
 String generatedPassword = "notSecret!";
 Keytab keytab = new Keytab();
 List<KeytabEntry> entries = new ArrayList<>();
 for (String principal : principals) {
   createPrincipal(principal, generatedPassword);
   principal = principal + "@" + getRealm();
   KerberosTime timestamp = new KerberosTime();
   for (Map.Entry<EncryptionType, EncryptionKey> entry : KerberosKeyFactory.getKerberosKeys(principal, generatedPassword).entrySet()) {
    EncryptionKey ekey = entry.getValue();
    byte keyVersion = (byte) ekey.getKeyVersion();
    entries.add(new KeytabEntry(principal, 1L, timestamp, keyVersion, ekey));
   }
 }
 keytab.setEntries(entries);
 keytab.write(keytabFile);
}

相关文章