java.lang.Object
org.apache.kerby.kerberos.kerb.admin.kadmin.local.AdminHelper

public final class AdminHelper extends Object
LocalKadmin utilities.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.kerby.kerberos.kerb.request.KrbIdentity
    createIdentity(String principal, org.apache.kerby.KOptions kOptions)
    Create principal.
    static org.apache.kerby.kerberos.kerb.keytab.Keytab
    If keytab file does not exist, create a new keytab, otherwise load keytab from keytab file.
    static void
    exportKeytab(File keytabFile, List<org.apache.kerby.kerberos.kerb.request.KrbIdentity> identities)
    Export all the keys of the specified principal into the specified keytab file.
    static void
    exportKeytab(File keytabFile, org.apache.kerby.kerberos.kerb.request.KrbIdentity identity)
    Export all the keys of the specified principal into the specified keytab file.
    static void
    exportToKeytab(org.apache.kerby.kerberos.kerb.keytab.Keytab keytab, org.apache.kerby.kerberos.kerb.request.KrbIdentity identity)
    Export all the keys of the specified identity into the keytab.
    static Pattern
    Get all the Pattern for matching from glob string.
    static org.apache.kerby.kerberos.kerb.keytab.Keytab
    loadKeytab(File keytabFile)
    Load keytab from keytab file.
    static org.apache.kerby.kerberos.kerb.keytab.Keytab
    loadKeytab(InputStream keytabInputStream)
    Load keytab from Input stream.
    static void
    removeKeytabEntriesOf(File keytabFile, String principalName)
    Remove all the keys of the specified principal in the specified keytab file.
    static void
    removeOldKeytabEntriesOf(File keytabFile, String principalName)
    Remove all the old keys of the specified principal in the specified keytab file.
    static void
    storeKeytab(org.apache.kerby.kerberos.kerb.keytab.Keytab keytab, File keytabFile)
    Store the keytab to keytab file.
    static void
    updateIdentity(org.apache.kerby.kerberos.kerb.request.KrbIdentity identity, org.apache.kerby.KOptions kOptions)
    Modify the principal with KOptions.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • exportKeytab

      public static void exportKeytab(File keytabFile, org.apache.kerby.kerberos.kerb.request.KrbIdentity identity) throws org.apache.kerby.kerberos.kerb.KrbException
      Export all the keys of the specified principal into the specified keytab file.
      Parameters:
      keytabFile - The keytab file
      identity - The identity
      Throws:
      org.apache.kerby.kerberos.kerb.KrbException - If there is a problem exporting the keys of the specified principal
    • exportKeytab

      public static void exportKeytab(File keytabFile, List<org.apache.kerby.kerberos.kerb.request.KrbIdentity> identities) throws org.apache.kerby.kerberos.kerb.KrbException
      Export all the keys of the specified principal into the specified keytab file.
      Parameters:
      keytabFile - The keytab file
      identities - Identities to export to keytabFile
      Throws:
      org.apache.kerby.kerberos.kerb.KrbException - If there is a problem exporting the keys of the specified principal
    • loadKeytab

      public static org.apache.kerby.kerberos.kerb.keytab.Keytab loadKeytab(File keytabFile) throws org.apache.kerby.kerberos.kerb.KrbException
      Load keytab from keytab file.
      Parameters:
      keytabFile - The keytab file
      Returns:
      The keytab load from keytab file
      Throws:
      org.apache.kerby.kerberos.kerb.KrbException - If there is a problem loading the keytab
    • loadKeytab

      public static org.apache.kerby.kerberos.kerb.keytab.Keytab loadKeytab(InputStream keytabInputStream) throws org.apache.kerby.kerberos.kerb.KrbException
      Load keytab from Input stream.
      Parameters:
      keytabInputStream - The Input stream
      Returns:
      The keytab load from keytab file
      Throws:
      org.apache.kerby.kerberos.kerb.KrbException - If there is a problem loading the Input stream
    • createOrLoadKeytab

      public static org.apache.kerby.kerberos.kerb.keytab.Keytab createOrLoadKeytab(File keytabFile) throws org.apache.kerby.kerberos.kerb.KrbException
      If keytab file does not exist, create a new keytab, otherwise load keytab from keytab file.
      Parameters:
      keytabFile - The keytab file
      Returns:
      The keytab load from keytab file
      Throws:
      org.apache.kerby.kerberos.kerb.KrbException - If there is a problem creating or loading the keytab
    • exportToKeytab

      public static void exportToKeytab(org.apache.kerby.kerberos.kerb.keytab.Keytab keytab, org.apache.kerby.kerberos.kerb.request.KrbIdentity identity) throws org.apache.kerby.kerberos.kerb.KrbException
      Export all the keys of the specified identity into the keytab.
      Parameters:
      keytab - The keytab
      identity - The identity
      Throws:
      org.apache.kerby.kerberos.kerb.KrbException - If there is a problem exporting the identity to the keytab
    • storeKeytab

      public static void storeKeytab(org.apache.kerby.kerberos.kerb.keytab.Keytab keytab, File keytabFile) throws org.apache.kerby.kerberos.kerb.KrbException
      Store the keytab to keytab file.
      Parameters:
      keytab - The keytab
      keytabFile - The keytab file
      Throws:
      org.apache.kerby.kerberos.kerb.KrbException - If there is a problem storing the keytab
    • removeKeytabEntriesOf

      public static void removeKeytabEntriesOf(File keytabFile, String principalName) throws org.apache.kerby.kerberos.kerb.KrbException
      Remove all the keys of the specified principal in the specified keytab file.
      Parameters:
      keytabFile - The keytab file
      principalName - The principal name
      Throws:
      org.apache.kerby.kerberos.kerb.KrbException - If there is a problem removing the keys of the specified principal
    • removeOldKeytabEntriesOf

      public static void removeOldKeytabEntriesOf(File keytabFile, String principalName) throws org.apache.kerby.kerberos.kerb.KrbException
      Remove all the old keys of the specified principal in the specified keytab file.
      Parameters:
      keytabFile - The keytab file
      principalName - The principal name
      Throws:
      org.apache.kerby.kerberos.kerb.KrbException - If there is a problem in removing the old keys of the specified principal
    • createIdentity

      public static org.apache.kerby.kerberos.kerb.request.KrbIdentity createIdentity(String principal, org.apache.kerby.KOptions kOptions) throws org.apache.kerby.kerberos.kerb.KrbException
      Create principal.
      Parameters:
      principal - The principal name to be created
      kOptions - The KOptions with principal info
      Returns:
      the created principal identity
      Throws:
      org.apache.kerby.kerberos.kerb.KrbException - If there is a problem in creating the principal
    • updateIdentity

      public static void updateIdentity(org.apache.kerby.kerberos.kerb.request.KrbIdentity identity, org.apache.kerby.KOptions kOptions)
      Modify the principal with KOptions.
      Parameters:
      identity - The identity to be modified
      kOptions - The KOptions with changed principal info
    • getPatternFromGlobPatternString

      public static Pattern getPatternFromGlobPatternString(String globString) throws org.apache.kerby.kerberos.kerb.KrbException
      Get all the Pattern for matching from glob string. The glob string can contain "." "*" and "[]"
      Parameters:
      globString - The glob string for matching
      Returns:
      pattern
      Throws:
      org.apache.kerby.kerberos.kerb.KrbException - If there is a problem in compiling the pattern string